Skip to content

Commit 19fc8d9

Browse files
chore(deps): update from template
1 parent 5a813be commit 19fc8d9

7 files changed

Lines changed: 26 additions & 7 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_commit: v0.10.7
1+
_commit: v0.10.10
22
_src_path: gh:helmut-hoffer-von-ankershoffen/oe-python-template
33
attestations_enabled: true
44
author_email: helmuthva@gmail.com

.github/workflows/test-and-report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
envkey_ENV: "TEST"
5858
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOGFIRE_TOKEN: "${{ secrets.OE_PYTHON_TEMPLATE_EXAMPLE_LOGFIRE_TOKEN }}"
5959
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_SENTRY_DSN: "${{ secrets.OE_PYTHON_TEMPLATE_EXAMPLE_SENTRY_DSN }}"
60-
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOGGING_LOG_LEVEL: "DEBUG"
61-
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOGGING_LOG_FILE_ENABLED: 1
60+
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOG_LEVEL: "DEBUG"
61+
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOG_FILE_ENABLED: 1
6262
fail_on_empty: false
6363

6464
- name: Validate installation

.github/workflows/test-scheduled.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
envkey_ENV: "TEST"
3333
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOGFIRE_TOKEN: "${{ secrets.OE_PYTHON_TEMPLATE_EXAMPLE_LOGFIRE_TOKEN }}"
3434
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_SENTRY_DSN: "${{ secrets.OE_PYTHON_TEMPLATE_EXAMPLE_SENTRY_DSN }}"
35-
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOGGING_LOG_LEVEL: "DEBUG"
36-
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOGGING_LOG_FILE_ENABLED: 1
35+
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOG_LEVEL: "DEBUG"
36+
envkey_OE_PYTHON_TEMPLATE_EXAMPLE_LOG_FILE_ENABLED: 1
3737
fail_on_empty: false
3838

3939
- name: Run scheduled tests

src/oe_python_template_example/api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
VersionedAPIRouter,
1414
__author_email__,
1515
__author_name__,
16+
__base__url__,
1617
__documentation__url__,
1718
__repository_url__,
1819
locate_implementations,
@@ -26,6 +27,9 @@
2627
CONTACT_URL = __repository_url__
2728
TERMS_OF_SERVICE_URL = __documentation__url__
2829

30+
API_BASE_URL = __base__url__
31+
if not API_BASE_URL:
32+
API_BASE_URL = f"http://{UVICORN_HOST}:{UVICORN_PORT}"
2933

3034
app = FastAPI(
3135
root_path="/api",
@@ -42,7 +46,7 @@
4246
"description": f"API version {version.lstrip('v')}, check link on the right",
4347
"externalDocs": {
4448
"description": "sub-docs",
45-
"url": f"http://{UVICORN_HOST}:{UVICORN_PORT}/api/{version}/docs",
49+
"url": f"{API_BASE_URL}/api/{version}/docs",
4650
},
4751
}
4852
for version, _ in API_VERSIONS.items()

src/oe_python_template_example/system/_service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ def info(include_environ: bool = False, filter_secrets: bool = True) -> dict[str
149149
for settings_class in locate_subclasses(BaseSettings):
150150
settings_instance = load_settings(settings_class)
151151
env_prefix = settings_instance.model_config.get("env_prefix", "")
152-
settings_dict = settings_instance.model_dump(context={UNHIDE_SENSITIVE_INFO: not filter_secrets})
152+
settings_dict = json.loads(
153+
settings_instance.model_dump_json(context={UNHIDE_SENSITIVE_INFO: not filter_secrets})
154+
)
153155
for key, value in settings_dict.items():
154156
flat_key = f"{env_prefix}{key}".upper()
155157
settings[flat_key] = value

src/oe_python_template_example/utils/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ._constants import (
77
__author_email__,
88
__author_name__,
9+
__base__url__,
910
__documentation__url__,
1011
__env__,
1112
__env_file__,
@@ -39,6 +40,7 @@
3940
"VersionedAPIRouter",
4041
"__author_email__",
4142
"__author_name__",
43+
"__base__url__",
4244
"__documentation__url__",
4345
"__env__",
4446
"__env_file__",

src/oe_python_template_example/utils/_constants.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
from importlib import metadata
66
from pathlib import Path
77

8+
from dotenv import load_dotenv
9+
10+
load_dotenv()
11+
812
__project_name__ = __name__.split(".")[0]
913
__project_path__ = str(Path(__file__).parent.parent.parent)
1014
__version__ = metadata.version(__project_name__)
@@ -21,6 +25,13 @@
2125
if env_file_path:
2226
__env_file__.insert(2, Path(env_file_path))
2327

28+
vercel_base_url = os.getenv("VERCEL_URL", None)
29+
if vercel_base_url:
30+
vercel_base_url = "https://" + vercel_base_url
31+
__base__url__ = os.getenv(__project_name__.upper() + "_BASE_URL", None)
32+
if not __base__url__ and vercel_base_url:
33+
__base__url__ = vercel_base_url
34+
2435

2536
def get_project_url_by_label(prefix: str) -> str:
2637
"""Get labeled Project-URL.

0 commit comments

Comments
 (0)