-
Notifications
You must be signed in to change notification settings - Fork 1
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
454cf67
commit 5891061
Showing
4 changed files
with
58 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
from pathlib import Path | ||
from typing import List, Optional | ||
|
||
from pydantic import BaseSettings as _BaseSettings | ||
from pydantic_settings import SettingsConfigDict, BaseSettings as _BaseSettings | ||
from starlette.datastructures import CommaSeparatedStrings | ||
|
||
from routing_packager_app.constants import Providers | ||
|
@@ -45,6 +45,8 @@ class BaseSettings(_BaseSettings): | |
SMTP_PASS: str = "" | ||
SMTP_SECURE: bool = False | ||
|
||
model_config = SettingsConfigDict(extra="ignore") | ||
|
||
def get_valhalla_path(self, port: int) -> Path: # pragma: no cover | ||
""" | ||
Return the path to the OSM Valhalla instances. | ||
|
@@ -69,15 +71,11 @@ def get_data_dir(self) -> Path: | |
|
||
|
||
class ProdSettings(BaseSettings): | ||
class Config: | ||
case_sensitive = True | ||
env_file = ENV_FILE | ||
model_config = SettingsConfigDict(case_sensitive=True, env_file=ENV_FILE, extra="ignore") | ||
|
||
|
||
class DevSettings(BaseSettings): | ||
class Config: | ||
case_sensitive = True | ||
env_file = ENV_FILE | ||
model_config = SettingsConfigDict(case_sensitive=True, env_file=ENV_FILE, extra="ignore") | ||
|
||
|
||
class TestSettings(BaseSettings): | ||
|
@@ -89,17 +87,18 @@ class TestSettings(BaseSettings): | |
POSTGRES_PASS: str = "admin" | ||
|
||
DATA_DIR: Path = BASE_DIR.joinpath("tests", "data") | ||
TMP_DATA_DIR: Path = BASE_DIR.joinpath("tests", "tmp_data") | ||
|
||
ADMIN_EMAIL: str = "[email protected]" | ||
ADMIN_PASS: str = "admin" | ||
|
||
class Config: | ||
case_sensitive = True | ||
env_file = BASE_DIR.joinpath("tests", "env") | ||
model_config = SettingsConfigDict( | ||
case_sensitive=True, env_file=BASE_DIR.joinpath("tests", "env"), extra="ignore" | ||
) | ||
|
||
|
||
# decide which settings we'll use | ||
SETTINGS: Optional[BaseSettings] = None | ||
print("LOADING SETTINGS") | ||
env = os.getenv("API_CONFIG", "prod") | ||
if env == "prod": # pragma: no cover | ||
SETTINGS = ProdSettings() | ||
|
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