1st commit
This commit is contained in:
38
app/config.py
Normal file
38
app/config.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
from pydantic_settings import BaseSettings
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
class Settings(BaseSettings):
|
||||
geo_provider: str = os.getenv('GEO_PROVIDER', 'maxmind')
|
||||
|
||||
# MaxMind
|
||||
maxmind_account_id: str | None = os.getenv('MAXMIND_ACCOUNT_ID')
|
||||
maxmind_license_key: str | None = os.getenv('MAXMIND_LICENSE_KEY')
|
||||
maxmind_db_name: str = os.getenv('MAXMIND_DB_NAME', 'GeoLite2-City')
|
||||
maxmind_db_path: str = os.getenv('MAXMIND_DB_PATH', '/data/GeoLite2-City.mmdb')
|
||||
maxmind_download_url_template: str = os.getenv(
|
||||
'MAXMIND_DOWNLOAD_URL_TEMPLATE',
|
||||
'https://download.maxmind.com/app/geoip_download?edition_id={DBNAME}&license_key={LICENSE_KEY}&suffix=tar.gz'
|
||||
)
|
||||
maxmind_direct_db_url: str | None = os.getenv('MAXMIND_DIRECT_DB_URL')
|
||||
maxmind_github_repo: str | None = os.getenv('MAXMIND_GITHUB_REPO')
|
||||
github_token: str | None = os.getenv('GITHUB_TOKEN')
|
||||
|
||||
# IP2Location
|
||||
ip2location_download_url: str | None = os.getenv('IP2LOCATION_DOWNLOAD_URL')
|
||||
ip2location_db_path: str = os.getenv('IP2LOCATION_DB_PATH', '/data/IP2LOCATION.BIN')
|
||||
|
||||
update_interval_seconds: int = int(os.getenv('UPDATE_INTERVAL_SECONDS', '86400'))
|
||||
|
||||
host: str = os.getenv('HOST', '0.0.0.0')
|
||||
port: int = int(os.getenv('PORT', '8000'))
|
||||
log_level: str = os.getenv('LOG_LEVEL', 'info')
|
||||
|
||||
admin_user: str | None = os.getenv('ADMIN_USER')
|
||||
admin_pass: str | None = os.getenv('ADMIN_PASS')
|
||||
cache_maxsize: int = int(os.getenv('CACHE_MAXSIZE', '4096'))
|
||||
|
||||
|
||||
settings = Settings()
|
Reference in New Issue
Block a user