def health_check(): settings = get_settings() return { "title": settings.WEB_APP_TITLE, "description": settings.WEB_APP_DESCRIPTION, "version": settings.WEB_APP_VERSION, "status": StatusEnum.OK, }
def start_web_server() -> None: settings = get_settings() uvicorn.run( "app:web_app", host=settings.WEB_SERVER_HOST, port=settings.WEB_SERVER_PORT, reload=settings.WEB_SERVER_RELOAD, log_level=settings.LOG_LEVEL, )
def env_settings(): return get_settings()
# flake8: noqa from logging.config import fileConfig from alembic import context from sqlalchemy import engine_from_config, pool import app.infra.database.models from app.config.environment import get_settings from app.infra.database.sqlalchemy import metadata _SETTINGS = get_settings() # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config config.set_main_option("sqlalchemy.url", str(_SETTINGS.DATABASE_PG_URL)) # Interpret the config file for Python logging. # This line sets up loggers basically. fileConfig(config.config_file_name) # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata target_metadata = metadata # other values from the config, defined by the needs of env.py, # can be acquired: # my_important_option = config.get_main_option("my_important_option")
from operator import attrgetter from app.config.environment import get_settings secret_key = attrgetter("JWT_SECRET_KEY")(get_settings()) def auth_headers(token): return {"Authorization": f"Bearer {token}"} def build_form_data(credentials): return { "grant_type": "password", "username": credentials.email, "password": credentials.password, }
def test_initial_settings(): assert get_settings()