-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
30 lines (23 loc) · 790 Bytes
/
config.py
File metadata and controls
30 lines (23 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from pydantic import BaseModel
from pydantic_settings import BaseSettings, SettingsConfigDict
from pathlib import Path
class RunConfig(BaseModel):
host: str = "0.0.0.0"
port: int = 8080
class Database:
def __init__(self):
self.path = str(Path(__file__).resolve().parent / "VPN_db.sqlite3")
self.echo = True
@property
def get_db_url(self):
return f"sqlite+aiosqlite:///{self.path}"
class Server:
SERVER_PUBLIC_KEY = "ваш_публичный_ключ_сервера"
SERVER_IP = "ваш_IP_адрес"
VPN_SUBNET = "10.0.0.0/24"
class Settings(BaseSettings):
run: RunConfig = RunConfig()
db: Database = Database()
serv: Server = Server()
model_config = SettingsConfigDict(env_file="pass")
settings = Settings()