Change default location

This commit is contained in:
phil 2024-11-01 06:00:37 +01:00
parent 7c33cb0b99
commit ae0d3532aa

View file

@ -65,9 +65,10 @@ def create_dirs():
def get_cache_dir() -> Path: def get_cache_dir() -> Path:
return Path(conf.storage.root_cache_path) return Path(conf.storage.root_cache_path)
class MyBaseSettings(BaseSettings): class MyBaseSettings(BaseSettings):
model_config = SettingsConfigDict( model_config = SettingsConfigDict(
env_prefix='treetrail_', env_prefix="treetrail_",
env_nested_delimiter="_", env_nested_delimiter="_",
) )
@ -113,8 +114,8 @@ class Tiles(MyBaseSettings):
class Map(MyBaseSettings): class Map(MyBaseSettings):
zoom: float = 14.0 zoom: float = 14.0
pitch: float = 0.0 pitch: float = 0.0
lat: float = 12.0000 lat: float = 45.8822
lng: float = 79.8106 lng: float = 6.1781
bearing: float = 0 bearing: float = 0
background: str = "OpenFreeMap" background: str = "OpenFreeMap"
@ -128,6 +129,7 @@ class Security(MyBaseSettings):
""" """
JWT security configuration JWT security configuration
""" """
secret_key: str = token_hex(32) secret_key: str = token_hex(32)
'''Generate with eg.: "openssl rand -hex 32"''' '''Generate with eg.: "openssl rand -hex 32"'''
access_token_expire_minutes: float = 30 access_token_expire_minutes: float = 30
@ -156,14 +158,14 @@ class Config(MyBaseSettings):
storage: Storage = Storage() storage: Storage = Storage()
map: Map = Map() map: Map = Map()
mapStyles: dict[str, str] = { mapStyles: dict[str, str] = {
'OpenFreeMap': 'https://tiles.openfreemap.org/styles/liberty' "OpenFreeMap": "https://tiles.openfreemap.org/styles/liberty"
} }
tiles: Tiles = Tiles() tiles: Tiles = Tiles()
security: Security = Security() security: Security = Security()
geo: Geo = Geo() geo: Geo = Geo()
version: str version: str
db: DB = DB() db: DB = DB()
base_href: str = '/treetrail' base_href: str = "/treetrail"
conf = Config(version=__version__) # type: ignore conf = Config(version=__version__) # type: ignore