From 361411b03f47e56ab3855ca2a8e5079d75771d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 21 Nov 2021 12:29:36 +0100 Subject: [PATCH] Add footer --- .env.sample | 1 + Dockerfile | 1 + src/runboat/app.py | 8 +--- src/runboat/settings.py | 2 + .../build.html.jinja} | 3 +- .../builds.html.jinja} | 3 +- .../runboat-build-element.js | 0 src/runboat/webui.py | 48 +++++++++++++++++++ 8 files changed, 58 insertions(+), 8 deletions(-) rename src/runboat/{webui/build.html => webui-templates/build.html.jinja} (71%) rename src/runboat/{webui/builds.html => webui-templates/builds.html.jinja} (87%) rename src/runboat/{webui => webui-templates}/runboat-build-element.js (100%) diff --git a/.env.sample b/.env.sample index 311ebc2..31d0089 100644 --- a/.env.sample +++ b/.env.sample @@ -9,3 +9,4 @@ RUNBOAT_BUILD_TEMPLATE_VARS={"storageClassName": "my-storage-class"} RUNBOAT_GITHUB_TOKEN= RUNBOAT_LOG_CONFIG=log-config.yaml RUNBOAT_BASE_URL=https://runboat.odoo-community.org +RUNBOAT_ADDITIONAL_FOOTER_HTML="" diff --git a/Dockerfile b/Dockerfile index a5ab924..39d179a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,7 @@ ENV RUNBOAT_BUILD_SECRET_ENV='{"PGPASSWORD": "..."}' ENV RUNBOAT_BUILD_TEMPLATE_VARS='{}' ENV RUNBOAT_GITHUB_TOKEN= ENV RUNBOAT_BASE_URL=https://runboat.example.com +ENV RUNBOAT_ADDITIONAL_FOOTER_HTML='' # KUBECONFIG to be provided by user, unless running in cluster with a service account # having the necessary permissions. diff --git a/src/runboat/app.py b/src/runboat/app.py index 103924d..11c317d 100644 --- a/src/runboat/app.py +++ b/src/runboat/app.py @@ -1,7 +1,4 @@ -from pathlib import Path - from fastapi import FastAPI -from fastapi.staticfiles import StaticFiles from . import __version__, api, controller, k8s, webhooks, webui @@ -11,9 +8,8 @@ app = FastAPI( app.include_router(api.router, prefix="/api/v1", tags=["api"]) app.include_router(webhooks.router, tags=["webhooks"]) app.include_router(webui.router, tags=["webui"]) -app.mount( - "/webui", StaticFiles(directory=Path(__file__).parent / "webui"), name="webui" -) + +webui.mount(app) @app.on_event("startup") diff --git a/src/runboat/settings.py b/src/runboat/settings.py index 832dfbd..8cfcc1b 100644 --- a/src/runboat/settings.py +++ b/src/runboat/settings.py @@ -49,6 +49,8 @@ class Settings(BaseSettings): # The base url where the runboat UI and API is exposed on internet. # Used to generate backlinks in GitHub statuses base_url: str = "http://localhost:8000" + # HTML fragment for second footer. + additional_footer_html: str = "" class Config: env_prefix = "RUNBOAT_" diff --git a/src/runboat/webui/build.html b/src/runboat/webui-templates/build.html.jinja similarity index 71% rename from src/runboat/webui/build.html rename to src/runboat/webui-templates/build.html.jinja index ecf49d8..4b8e7d9 100644 --- a/src/runboat/webui/build.html +++ b/src/runboat/webui-templates/build.html.jinja @@ -14,7 +14,8 @@