StoreCopilot / src /core /config.py
Elie Brosset
Add app
6739f59
import os
from functools import lru_cache
from pydantic import BaseSettings
class Settings(BaseSettings):
"""
BaseSettings, from Pydantic, validates the data so that when we create an instance of Settings,
environment and testing will have types of str and bool, respectively.
Parameters:
Returns:
instance of Settings
"""
VERSION: str = "2.5.0"
DESCRIPTION: str = "Humanitics Webapp"
PROJECT_NAME: str = "Humanitics"
DEBUG: bool = os.getenv("DEBUG", False)
# auth0
AUTH0_DOMAIN: str = os.getenv("AUTH0_DOMAIN", "humanitics.eu.auth0.com")
AUTH0_AUDIENCE: str = os.getenv(
"AUTH0_AUDIENCE", "https://humanitics.eu.auth0.com"
)
AUTH0_CLIENT_ID: str = os.getenv("AUTH0_CLIENT_ID", "")
AUTH0_CLIENT_SECRET: str = os.getenv("AUTH0_CLIENT_SECRET", "")
AUTH0_CALLBACK_URL: str = os.getenv(
"AUTH0_CALLBACK_URL", "http://localhost:8000/callback"
)
APP_SECRET_KEY: str = os.getenv("APP_SECRET_KEY", "")
# flask
SECRET_KEY: str = os.getenv("SECRET_KEY", "secret")
SESSION_COOKIE_NAME: str = os.getenv("SESSION_COOKIE_NAME", "humanitics")
SESSION_COOKIE_SECURE: bool = os.getenv("SESSION_COOKIE_SECURE", False)
SESSION_COOKIE_HTTPONLY: bool = os.getenv("SESSION_COOKIE_HTTPONLY", True)
# pages
LOGIN_URL: str = os.getenv("LOGIN_URL", "/login")
LOGOUT_URL: str = os.getenv("LOGOUT_URL", "/logout")
CALLBACK_URL: str = os.getenv("CALLBACK_URL", "/callback")
REDIRECT_URI: str = os.getenv(
"REDIRECT_URI", "http://localhost:8000/callback"
)
# keys session
JWT_PAYLOAD: str = os.getenv("JWT_PAYLOAD", "jwt_payload")
PROFILE_KEY: str = os.getenv("PROFILE_KEY", "profile")
# Data Folder
DATA_FOLDER: str = os.getenv("DATA_FOLDER", "data")
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
@lru_cache
def get_settings():
return Settings()