diff --git a/app/config/app.py b/app/config/app.py index 82caa37..d961985 100644 --- a/app/config/app.py +++ b/app/config/app.py @@ -13,9 +13,9 @@ class GlobalConfig(BaseSettings): # This variable will be loaded from the .env file. However, if there is a # shell environment variable having the same name, that will take precedence. - ENV_STATE: Optional[str] = pydantic.Field(None, env="ENV_STATE") - HOST: Optional[str] = pydantic.Field(None, env="HOST") - PORT: Optional[str] = pydantic.Field(None, env="PORT") + ENV_STATE: Optional[str] = pydantic.Field(None, env="ENV_STATE") # type: ignore + HOST: Optional[str] = pydantic.Field(None, env="HOST") # type: ignore + PORT: Optional[str] = pydantic.Field(None, env="PORT") # type: ignore model_config = SettingsConfigDict( env_file=".env", @@ -29,37 +29,59 @@ class GlobalConfig(BaseSettings): class DevConfig(GlobalConfig): """Development configurations.""" - ROOT_PATH: Optional[str] = pydantic.Field(None, env="DEV_ROOT_PATH") + ROOT_PATH: Optional[str] = pydantic.Field(None, env="DEV_ROOT_PATH") # type: ignore AWS_LAMBDA_DEPLOY: Optional[bool] = pydantic.Field( None, env="DEV_AWS_LAMBDA_DEPLOY" - ) - LOG_PATH: Optional[str] = pydantic.Field(None, env="DEV_LOG_PATH") - LOG_FILENAME: Optional[str] = pydantic.Field(None, env="DEV_LOG_FILENAME") - LOG_LEVEL: Optional[str] = pydantic.Field(None, env="DEV_LOG_LEVEL") - LOG_ENQUEUE: Optional[bool] = pydantic.Field(None, env="DEV_LOG_ENQUEUE") - LOG_ROTATION: Optional[str] = pydantic.Field(None, env="DEV_LOG_ROTATION") - LOG_RETENTION: Optional[str] = pydantic.Field(None, env="DEV_LOG_RETENTION") - LOG_FORMAT: Optional[str] = pydantic.Field(None, env="DEV_LOG_FORMAT") - OPA_ENABLED: Optional[bool] = pydantic.Field(None, env="DEV_OPA_ENABLED") - OPA_URL: Optional[str] = pydantic.Field(None, env="DEV_OPA_URL") - APP_URI: Optional[str] = pydantic.Field(None, env="DEV_APP_URI") + ) # type: ignore + LOG_PATH: Optional[str] = pydantic.Field(None, env="DEV_LOG_PATH") # type: ignore + LOG_FILENAME: Optional[str] = pydantic.Field( + None, env="DEV_LOG_FILENAME" + ) # type: ignore + LOG_LEVEL: Optional[str] = pydantic.Field(None, env="DEV_LOG_LEVEL") # type: ignore + LOG_ENQUEUE: Optional[bool] = pydantic.Field( + None, env="DEV_LOG_ENQUEUE" + ) # type: ignore + LOG_ROTATION: Optional[str] = pydantic.Field( + None, env="DEV_LOG_ROTATION" + ) # type: ignore + LOG_RETENTION: Optional[str] = pydantic.Field( + None, env="DEV_LOG_RETENTION" + ) # type: ignore + LOG_FORMAT: Optional[str] = pydantic.Field( + None, env="DEV_LOG_FORMAT" + ) # type: ignore + OPA_ENABLED: Optional[bool] = pydantic.Field( + None, env="DEV_OPA_ENABLED" + ) # type: ignore + OPA_URL: Optional[str] = pydantic.Field(None, env="DEV_OPA_URL") # type: ignore + APP_URI: Optional[str] = pydantic.Field(None, env="DEV_APP_URI") # type: ignore OIDC_WELL_KNOWN_ENDPOINT: Optional[str] = pydantic.Field( None, env="DEV_OIDC_WELL_KNOWN_ENDPOINT" - ) - OIDC_CLIENT_ID: Optional[str] = pydantic.Field(None, env="DEV_OIDC_CLIENT_ID") + ) # type: ignore + OIDC_CLIENT_ID: Optional[str] = pydantic.Field( + None, env="DEV_OIDC_CLIENT_ID" + ) # type: ignore OIDC_CLIENT_SECRET: Optional[str] = pydantic.Field( None, env="DEV_OIDC_CLIENT_SECRET" - ) - API_KEY_ENABLED: Optional[bool] = pydantic.Field(None, env="DEV_API_KEY_ENABLED") + ) # type: ignore + API_KEY_ENABLED: Optional[bool] = pydantic.Field( + None, env="DEV_API_KEY_ENABLED" + ) # type: ignore PYGEOAPI_KEY_GLOBAL: Optional[str] = pydantic.Field( None, env="DEV_PYGEOAPI_KEY_GLOBAL" - ) - PYGEOAPI_BASEURL: Optional[str] = pydantic.Field(None, env="DEV_PYGEOAPI_BASEURL") - PYGEOAPI_CONFIG: Optional[str] = pydantic.Field(None, env="DEV_PYGEOAPI_CONFIG") - PYGEOAPI_OPENAPI: Optional[str] = pydantic.Field(None, env="DEV_PYGEOAPI_OPENAPI") + ) # type: ignore + PYGEOAPI_BASEURL: Optional[str] = pydantic.Field( + None, env="DEV_PYGEOAPI_BASEURL" + ) # type: ignore + PYGEOAPI_CONFIG: Optional[str] = pydantic.Field( + None, env="DEV_PYGEOAPI_CONFIG" + ) # type: ignore + PYGEOAPI_OPENAPI: Optional[str] = pydantic.Field( + None, env="DEV_PYGEOAPI_OPENAPI" + ) # type: ignore FASTGEOAPI_CONTEXT: Optional[str] = pydantic.Field( None, env="DEV_FASTGEOAPI_CONTEXT" - ) + ) # type: ignore model_config = SettingsConfigDict(env_prefix="DEV_") @@ -67,37 +89,37 @@ class DevConfig(GlobalConfig): class ProdConfig(GlobalConfig): """Production configurations.""" - ROOT_PATH: Optional[str] = pydantic.Field(None, env="PROD_ROOT_PATH") + ROOT_PATH: Optional[str] = pydantic.Field(None, env="PROD_ROOT_PATH") # type: ignore AWS_LAMBDA_DEPLOY: Optional[bool] = pydantic.Field( None, env="PROD_AWS_LAMBDA_DEPLOY" - ) - LOG_PATH: Optional[str] = pydantic.Field(None, env="PROD_LOG_PATH") - LOG_FILENAME: Optional[str] = pydantic.Field(None, env="PROD_LOG_FILENAME") - LOG_LEVEL: Optional[str] = pydantic.Field(None, env="PROD_LOG_LEVEL") - LOG_ENQUEUE: Optional[bool] = pydantic.Field(None, env="PROD_LOG_ENQUEUE") - LOG_ROTATION: Optional[str] = pydantic.Field(None, env="PROD_LOG_ROTATION") - LOG_RETENTION: Optional[str] = pydantic.Field(None, env="PROD_LOG_RETENTION") - LOG_FORMAT: Optional[str] = pydantic.Field(None, env="PROD_LOG_FORMAT") - OPA_ENABLED: Optional[bool] = pydantic.Field(None, env="PROD_OPA_ENABLED") - OPA_URL: Optional[str] = pydantic.Field(None, env="PROD_OPA_URL") - APP_URI: Optional[str] = pydantic.Field(None, env="PROD_APP_URI") + ) # type: ignore + LOG_PATH: Optional[str] = pydantic.Field(None, env="PROD_LOG_PATH") # type: ignore + LOG_FILENAME: Optional[str] = pydantic.Field(None, env="PROD_LOG_FILENAME") # type: ignore + LOG_LEVEL: Optional[str] = pydantic.Field(None, env="PROD_LOG_LEVEL") # type: ignore + LOG_ENQUEUE: Optional[bool] = pydantic.Field(None, env="PROD_LOG_ENQUEUE") # type: ignore + LOG_ROTATION: Optional[str] = pydantic.Field(None, env="PROD_LOG_ROTATION") # type: ignore + LOG_RETENTION: Optional[str] = pydantic.Field(None, env="PROD_LOG_RETENTION") # type: ignore + LOG_FORMAT: Optional[str] = pydantic.Field(None, env="PROD_LOG_FORMAT") # type: ignore + OPA_ENABLED: Optional[bool] = pydantic.Field(None, env="PROD_OPA_ENABLED") # type: ignore + OPA_URL: Optional[str] = pydantic.Field(None, env="PROD_OPA_URL") # type: ignore + APP_URI: Optional[str] = pydantic.Field(None, env="PROD_APP_URI") # type: ignore OIDC_WELL_KNOWN_ENDPOINT: Optional[str] = pydantic.Field( None, env="PROD_OIDC_WELL_KNOWN_ENDPOINT" - ) - OIDC_CLIENT_ID: Optional[str] = pydantic.Field(None, env="PROD_OIDC_CLIENT_ID") + ) # type: ignore + OIDC_CLIENT_ID: Optional[str] = pydantic.Field(None, env="PROD_OIDC_CLIENT_ID") # type: ignore OIDC_CLIENT_SECRET: Optional[str] = pydantic.Field( None, env="PROD_OIDC_CLIENT_SECRET" - ) - API_KEY_ENABLED: Optional[bool] = pydantic.Field(None, env="PROD_API_KEY_ENABLED") + ) # type: ignore + API_KEY_ENABLED: Optional[bool] = pydantic.Field(None, env="PROD_API_KEY_ENABLED") # type: ignore PYGEOAPI_KEY_GLOBAL: Optional[str] = pydantic.Field( None, env="PROD_PYGEOAPI_KEY_GLOBAL" - ) - PYGEOAPI_BASEURL: Optional[str] = pydantic.Field(None, env="PROD_PYGEOAPI_BASEURL") - PYGEOAPI_CONFIG: Optional[str] = pydantic.Field(None, env="PROD_PYGEOAPI_CONFIG") - PYGEOAPI_OPENAPI: Optional[str] = pydantic.Field(None, env="PROD_PYGEOAPI_OPENAPI") + ) # type: ignore + PYGEOAPI_BASEURL: Optional[str] = pydantic.Field(None, env="PROD_PYGEOAPI_BASEURL") # type: ignore + PYGEOAPI_CONFIG: Optional[str] = pydantic.Field(None, env="PROD_PYGEOAPI_CONFIG") # type: ignore + PYGEOAPI_OPENAPI: Optional[str] = pydantic.Field(None, env="PROD_PYGEOAPI_OPENAPI") # type: ignore FASTGEOAPI_CONTEXT: Optional[str] = pydantic.Field( None, env="PROD_FASTGEOAPI_CONTEXT" - ) + ) # type: ignore model_config = SettingsConfigDict(env_prefix="PROD_") diff --git a/pyproject.toml b/pyproject.toml index 87add7b..4e0dd40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,6 +87,7 @@ show_missing = true fail_under = 100 [tool.mypy] +exclude = ".venv" strict = true warn_unreachable = true pretty = true