-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34bd5ee
commit d1e7268
Showing
9 changed files
with
106 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from typing import Optional | ||
|
||
from pydantic import BaseModel | ||
from pydantic_settings import BaseSettings, SettingsConfigDict | ||
from sblex.telemetry.settings import OTelSettings | ||
|
||
|
||
class AppSettings(BaseModel): | ||
base_url: Optional[str] = None | ||
root_path: str = "" | ||
template_directory: str = "templates" | ||
# model_config = SettingsConfigDict(env_file=".env", extra="ignore") | ||
|
||
|
||
class MatomoSettings(BaseModel): | ||
matomo_url: Optional[str] = None | ||
matomo_idsite: Optional[int] = None | ||
matomo_token: Optional[str] = None | ||
# model_config = SettingsConfigDict(env_file=".env", extra="ignore", env_prefix="TRACKING_") | ||
|
||
|
||
class FrontendSettings(BaseModel): | ||
tracking: MatomoSettings = MatomoSettings() | ||
|
||
|
||
class Settings(BaseSettings): | ||
semantic_path: str | ||
fm_server_url: str | ||
fm_server_url: str | ||
otel: OTelSettings | ||
app: AppSettings = AppSettings() | ||
frontend: FrontendSettings = FrontendSettings() | ||
tracking: MatomoSettings | ||
model_config = SettingsConfigDict( | ||
env_file=".env", extra="ignore", env_nested_delimiter="__", env_prefix="SALDO_WS__" | ||
) | ||
|
||
|
||
def read_settings_from_env() -> Settings: | ||
otel = OTelSettings(_env_prefix="SALDO_WS_") | ||
settings = Settings(otel=otel) | ||
return settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from sblex.saldo_ws import config, server | ||
|
||
settings = config.read_settings_from_env() | ||
print(f"{settings=}") | ||
|
||
# app = server.create_saldo_ws_server(settings=settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters