data_dir setting
This commit is contained in:
parent
f9762d4a54
commit
e9d6ad3811
1 changed files with 5 additions and 3 deletions
|
@ -4,7 +4,8 @@ import functools
|
||||||
import json
|
import json
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from secrets import token_hex
|
from pathlib import Path
|
||||||
|
from secrets import token_urlsafe
|
||||||
|
|
||||||
from jose import JWTError, jwt
|
from jose import JWTError, jwt
|
||||||
from jose.constants import ALGORITHMS
|
from jose.constants import ALGORITHMS
|
||||||
|
@ -16,7 +17,8 @@ from sqlalchemy.engine import Engine
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
production_mode: bool = False
|
production_mode: bool = False
|
||||||
config_file: str = "tmp/config.json"
|
data_dir: Path = Path("./tmp")
|
||||||
|
config_file: Path = Path("tmp/config.json")
|
||||||
openapi_url: str = "/openapi.json"
|
openapi_url: str = "/openapi.json"
|
||||||
docs_url: str | None = "/docs"
|
docs_url: str | None = "/docs"
|
||||||
redoc_url: str | None = "/redoc"
|
redoc_url: str | None = "/redoc"
|
||||||
|
@ -37,7 +39,7 @@ class DBConfig(BaseModel):
|
||||||
user: str | None = None
|
user: str | None = None
|
||||||
password: str | None = None
|
password: str | None = None
|
||||||
host: str | None = None
|
host: str | None = None
|
||||||
database: str | None = "./tmp/vpn.db"
|
database: str | None = Settings.get().data_dir.joinpath("vpn.db")
|
||||||
|
|
||||||
mysql_driver: str = "pymysql"
|
mysql_driver: str = "pymysql"
|
||||||
mysql_args: list[str] = ["charset=utf8mb4"]
|
mysql_args: list[str] = ["charset=utf8mb4"]
|
||||||
|
|
Loading…
Reference in a new issue