Skip to content

Commit 6cd31cc

Browse files
committed
Cleanup
1 parent d1b03f9 commit 6cd31cc

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

services/web/server/src/simcore_service_webserver/__version__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@
88

99
version = Version(__version__)
1010

11-
api_version_prefix: str = f"v{version.major}"
11+
app_name: str = __name__.split(".")[0]
12+
api_version: str = __version__
13+
api_vtag: str = f"v{version.major}"
14+
15+
# legacy
16+
api_version_prefix: str = api_vtag

services/web/server/src/simcore_service_webserver/settings.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88
from aiohttp import web
99
from pydantic import BaseSettings
1010

11-
APP_SETTINGS_KEY = f"{__name__ }.build_time_settings"
11+
from .__version__ import app_name, api_version
12+
13+
APP_SETTINGS_KEY = f"{__name__ }.app_settings"
1214

1315
log = logging.getLogger(__name__)
1416

1517

16-
class BuildTimeSettings(BaseSettings):
17-
# All these settings are defined in the Dockerfile at build-image time
18+
class ApplicationSettings(BaseSettings):
19+
# settings defined by the code
20+
app_name: str = app_name
21+
api_version: str = api_version
22+
23+
# settings defined when docker image is built
1824
vcs_url: Optional[str] = None
1925
vcs_ref: Optional[str] = None
2026
build_date: Optional[str] = None
@@ -43,5 +49,5 @@ def public_dict(self) -> Dict:
4349

4450

4551
def setup_settings(app: web.Application):
46-
app[APP_SETTINGS_KEY] = BuildTimeSettings()
52+
app[APP_SETTINGS_KEY] = ApplicationSettings()
4753
log.info("Captured app settings:\n%s", app[APP_SETTINGS_KEY].json(indent=2))

0 commit comments

Comments
 (0)