예제 #1
0
파일: __init__.py 프로젝트: GArmane/iheroes
def start_web_server() -> None:
    settings = get_settings()
    uvicorn.run(
        "iheroes_api:web_app",
        host=settings.WEB_SERVER_HOST,
        port=settings.WEB_SERVER_PORT,
        reload=settings.WEB_SERVER_RELOAD,
        log_level=settings.LOG_LEVEL,
    )
예제 #2
0
파일: env.py 프로젝트: GArmane/iheroes
# flake8: noqa

from logging.config import fileConfig

from alembic import context
from sqlalchemy import engine_from_config, pool

import iheroes_api.infra.database.models
from iheroes_api.config.environment import get_settings
from iheroes_api.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")
예제 #3
0
파일: conftest.py 프로젝트: GArmane/iheroes
def env_settings():
    return get_settings().copy(update={"ENV": "testing"})
예제 #4
0
파일: auth.py 프로젝트: GArmane/iheroes
from operator import attrgetter

from iheroes_api.config.environment import get_settings

oauth2_instrospect_url = "/account/oauth2/introspect"
oauth2_token_url = "/account/oauth2/token"
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,
    }
예제 #5
0
def test_get_settings():
    assert get_settings()
예제 #6
0
파일: __init__.py 프로젝트: GArmane/iheroes
import uvicorn

from iheroes_api.config.environment import get_settings
from iheroes_api.api import init_app


_SETTINGS = get_settings()


web_app = init_app(_SETTINGS)


def start_web_server() -> None:
    settings = get_settings()
    uvicorn.run(
        "iheroes_api:web_app",
        host=settings.WEB_SERVER_HOST,
        port=settings.WEB_SERVER_PORT,
        reload=settings.WEB_SERVER_RELOAD,
        log_level=settings.LOG_LEVEL,
    )