diff --git a/app/config.py b/app/config.py index bae74a4..7fbed3c 100644 --- a/app/config.py +++ b/app/config.py @@ -2,12 +2,13 @@ from pathlib import Path from typing import List, Literal, Optional +from pydantic import computed_field from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict( - env_prefix="XLWINGS_", env_file=os.getenv("DOTENV_PATH", ".env") + env_prefix="XLWINGS_", env_file=os.getenv("DOTENV_PATH", ".env"), extra="ignore" ) add_security_headers: bool = True base_dir: Path = Path(__file__).resolve().parent @@ -25,9 +26,13 @@ class Settings(BaseSettings): hostname: Optional[str] = None log_level: str = "INFO" public_addin_store: bool = False - static_dir: Path = base_dir / "static" license_key: str + @computed_field + @property + def static_dir(self) -> Path: + return self.base_dir / "static" + settings = Settings() diff --git a/app/main.py b/app/main.py index 329407f..6129349 100644 --- a/app/main.py +++ b/app/main.py @@ -95,6 +95,7 @@ async def root(): # Static files: in prod should be served via a HTTP server like nginx if possible +# See also pending ASGI branch in https://github.com/evansd/whitenoise app.mount("/static", StaticFiles(directory=settings.static_dir), name="static") if settings.environment == "development": # Don't cache static files diff --git a/app/routers/manifest.py b/app/routers/manifest.py index 14834a7..fef164d 100644 --- a/app/routers/manifest.py +++ b/app/routers/manifest.py @@ -13,8 +13,6 @@ @router.get("/manifest") async def manifest(request: Request): - logger.info(os.environ) - logger.info(os.getenv("RENDER_EXTERNAL_URL")) if settings.hostname: # Settings if settings.hostname.startswith("https://"): @@ -25,7 +23,6 @@ async def manifest(request: Request): elif os.getenv("RENDER_EXTERNAL_URL"): # Render base_url = os.getenv("RENDER_EXTERNAL_URL") - logger.info(base_url) elif os.getenv("WEBSITE_HOSTNAME"): # Azure Functions base_url = os.getenv("WEBSITE_HOSTNAME") diff --git a/app/static/images/examples/xlwings-16.png b/app/static/images/ribbon/examples/xlwings-16.png similarity index 100% rename from app/static/images/examples/xlwings-16.png rename to app/static/images/ribbon/examples/xlwings-16.png diff --git a/app/static/images/examples/xlwings-32.png b/app/static/images/ribbon/examples/xlwings-32.png similarity index 100% rename from app/static/images/examples/xlwings-32.png rename to app/static/images/ribbon/examples/xlwings-32.png diff --git a/app/static/images/examples/xlwings-64.png b/app/static/images/ribbon/examples/xlwings-64.png similarity index 100% rename from app/static/images/examples/xlwings-64.png rename to app/static/images/ribbon/examples/xlwings-64.png diff --git a/app/static/images/examples/xlwings-80.png b/app/static/images/ribbon/examples/xlwings-80.png similarity index 100% rename from app/static/images/examples/xlwings-80.png rename to app/static/images/ribbon/examples/xlwings-80.png diff --git a/app/templates/manifest.xml b/app/templates/manifest.xml index 2afd393..02bfa00 100644 --- a/app/templates/manifest.xml +++ b/app/templates/manifest.xml @@ -1,10 +1,8 @@ - + xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp"> 0a856eb1-91ab-4f38-b757-23fbe1f73130 1.0.0 @@ -12,8 +10,8 @@ en-US - - + + {{ base_url }} @@ -31,9 +29,7 @@ ReadWriteDocument - + @@ -43,7 +39,7 @@ @@ -119,9 +115,9 @@ - - - + + +