src.config.config module#

This module contains the configuration for the application. Depending on the environment, the configuration will be different.

class src.config.config.DevConfig(_env_file: Optional[Union[str, PathLike, List[Union[str, PathLike]], Tuple[Union[str, PathLike], ...]]] = '<object object>', _env_file_encoding: Optional[str] = None, _env_nested_delimiter: Optional[str] = None, _secrets_dir: Optional[Union[str, PathLike]] = None, *, ENV_STATE: Environment = Environment.DEV, FRONTEND_HOST: List[AnyHttpUrl] = [], MAX_UPLOAD_SIZE_GB: Union[int, float] = 10, SECURE_COOKIES: bool = False, ALGORITHM: str = 'HS256', SECRET_KEY: Optional[str] = None, DB_NAME: str = 'appStoreDB', MONGO_DSN: Optional[MongoDsn] = None, MONGO_USERNAME: Optional[str] = None, MONGO_PASSWORD: Optional[str] = None, MINIO_DSN: Optional[str] = None, MINIO_API_HOST: Optional[str] = None, MINIO_BUCKET_NAME: str = 'model-zoo', MINIO_TLS: bool = False, MINIO_API_ACCESS_KEY: Optional[str] = None, MINIO_API_SECRET_KEY: Optional[str] = None, IE_NAMESPACE: Optional[str] = None, IE_SERVICE_TYPE: ServiceBackend = ServiceBackend.EMISSARY, IE_DEFAULT_PROTOCOL: str = 'http', IE_DOMAIN: Optional[str] = None, IE_INGRESS_NAME: Optional[str] = None, IE_INGRESS_NAMESPACE: Optional[str] = None, K8S_HOST: Optional[str] = None, K8S_API_KEY: Optional[str] = None, CLEARML_CONFIG_FILE: Optional[str] = None, CLEARML_WEB_HOST: Optional[str] = None, CLEARML_API_HOST: Optional[str] = None, CLEARML_FILES_HOST: Optional[str] = None, CLEARML_API_ACCESS_KEY: Optional[str] = None, CLEARML_API_SECRET_KEY: Optional[str] = None, KEYCLOAK_SERVER_URL: Optional[str] = None, KEYCLOAK_REALM_NAME: str = 'CommonServices', KEYCLOAK_CLIENT_ID: str = 'ai-appstore-backend', KEYCLOAK_CLIENT_SECRET_KEY: Optional[str] = None, KEYCLOAK_AUTHORIZATION_URL: Optional[str] = None, KEYCLOAK_TOKEN_URL: Optional[str] = None)[source]#

Bases: GlobalConfig

Development configuration. Inherits from GlobalConfig, using environment variables that start with DEV_ as the default values.

ALGORITHM: str#
CLEARML_API_ACCESS_KEY: Optional[str]#
CLEARML_API_HOST: Optional[str]#
CLEARML_API_SECRET_KEY: Optional[str]#
CLEARML_CONFIG_FILE: Optional[str]#
CLEARML_FILES_HOST: Optional[str]#
CLEARML_WEB_HOST: Optional[str]#
class Config[source]#

Bases: object

Pydantic config class. Set the environment variable prefix to DEV_.

env_prefix: str = 'DEV_'#
DB_NAME: str#
ENV_STATE: Environment#
FRONTEND_HOST: List[AnyHttpUrl]#
IE_DEFAULT_PROTOCOL: str#
IE_DOMAIN: Optional[str]#
IE_INGRESS_NAME: Optional[str]#
IE_INGRESS_NAMESPACE: Optional[str]#
IE_NAMESPACE: Optional[str]#
IE_SERVICE_TYPE: ServiceBackend#
K8S_API_KEY: Optional[str]#
K8S_HOST: Optional[str]#
KEYCLOAK_AUTHORIZATION_URL: Optional[str]#
KEYCLOAK_CLIENT_ID: str#
KEYCLOAK_CLIENT_SECRET_KEY: Optional[str]#
KEYCLOAK_REALM_NAME: str#
KEYCLOAK_SERVER_URL: Optional[str]#
KEYCLOAK_TOKEN_URL: Optional[str]#
MAX_UPLOAD_SIZE_GB: Union[int, float]#
MINIO_API_ACCESS_KEY: Optional[str]#
MINIO_API_HOST: Optional[str]#
MINIO_API_SECRET_KEY: Optional[str]#
MINIO_BUCKET_NAME: str#
MINIO_DSN: Optional[str]#
MINIO_TLS: bool#
MONGO_DSN: Optional[MongoDsn]#
MONGO_PASSWORD: Optional[str]#
MONGO_USERNAME: Optional[str]#
SECRET_KEY: Optional[str]#
SECURE_COOKIES: bool#
_abc_impl = <_abc._abc_data object>#
class src.config.config.Environment(value)[source]#

Bases: str, Enum

Enum for the different environments.

DEV = 'dev'#
PROD = 'prod'#
STG = 'stg'#
TEST = 'test'#
_generate_next_value_(start, count, last_values)#

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_value: the last value assigned or None

_member_map_ = {'DEV': Environment.DEV, 'PROD': Environment.PROD, 'STG': Environment.STG, 'TEST': Environment.TEST}#
_member_names_ = ['DEV', 'STG', 'PROD', 'TEST']#
_member_type_#

alias of str

_value2member_map_ = {'dev': Environment.DEV, 'prod': Environment.PROD, 'stg': Environment.STG, 'test': Environment.TEST}#
class src.config.config.FactoryConfig(env_state: Optional[str])[source]#

Bases: object

Return config instance based on ENV_STATE variable

class src.config.config.GlobalConfig(_env_file: Optional[Union[str, PathLike, List[Union[str, PathLike]], Tuple[Union[str, PathLike], ...]]] = '<object object>', _env_file_encoding: Optional[str] = None, _env_nested_delimiter: Optional[str] = None, _secrets_dir: Optional[Union[str, PathLike]] = None, *, ENV_STATE: Environment = Environment.DEV, FRONTEND_HOST: List[AnyHttpUrl] = [], MAX_UPLOAD_SIZE_GB: Union[int, float] = 10, SECURE_COOKIES: bool = False, ALGORITHM: str = 'HS256', SECRET_KEY: Optional[str] = None, DB_NAME: str = 'appStoreDB', MONGO_DSN: Optional[MongoDsn] = None, MONGO_USERNAME: Optional[str] = None, MONGO_PASSWORD: Optional[str] = None, MINIO_DSN: Optional[str] = None, MINIO_API_HOST: Optional[str] = None, MINIO_BUCKET_NAME: str = 'model-zoo', MINIO_TLS: bool = False, MINIO_API_ACCESS_KEY: Optional[str] = None, MINIO_API_SECRET_KEY: Optional[str] = None, IE_NAMESPACE: Optional[str] = None, IE_SERVICE_TYPE: ServiceBackend = ServiceBackend.EMISSARY, IE_DEFAULT_PROTOCOL: str = 'http', IE_DOMAIN: Optional[str] = None, IE_INGRESS_NAME: Optional[str] = None, IE_INGRESS_NAMESPACE: Optional[str] = None, K8S_HOST: Optional[str] = None, K8S_API_KEY: Optional[str] = None, CLEARML_CONFIG_FILE: Optional[str] = None, CLEARML_WEB_HOST: Optional[str] = None, CLEARML_API_HOST: Optional[str] = None, CLEARML_FILES_HOST: Optional[str] = None, CLEARML_API_ACCESS_KEY: Optional[str] = None, CLEARML_API_SECRET_KEY: Optional[str] = None, KEYCLOAK_SERVER_URL: Optional[str] = None, KEYCLOAK_REALM_NAME: str = 'CommonServices', KEYCLOAK_CLIENT_ID: str = 'ai-appstore-backend', KEYCLOAK_CLIENT_SECRET_KEY: Optional[str] = None, KEYCLOAK_AUTHORIZATION_URL: Optional[str] = None, KEYCLOAK_TOKEN_URL: Optional[str] = None)[source]#

Bases: BaseSettings

Global configuration for the application.

ALGORITHM: str#
CLEARML_API_ACCESS_KEY: Optional[str]#
CLEARML_API_HOST: Optional[str]#
CLEARML_API_SECRET_KEY: Optional[str]#
CLEARML_CONFIG_FILE: Optional[str]#
CLEARML_FILES_HOST: Optional[str]#
CLEARML_WEB_HOST: Optional[str]#
class Config[source]#

Bases: object

Pydantic config class.

env_file: str = './src/config/.env'#
DB_NAME: str#
ENV_STATE: Environment#
FRONTEND_HOST: List[AnyHttpUrl]#
IE_DEFAULT_PROTOCOL: str#
IE_DOMAIN: Optional[str]#
IE_INGRESS_NAME: Optional[str]#
IE_INGRESS_NAMESPACE: Optional[str]#
IE_NAMESPACE: Optional[str]#
IE_SERVICE_TYPE: ServiceBackend#
K8S_API_KEY: Optional[str]#
K8S_HOST: Optional[str]#
KEYCLOAK_AUTHORIZATION_URL: Optional[str]#
KEYCLOAK_CLIENT_ID: str#
KEYCLOAK_CLIENT_SECRET_KEY: Optional[str]#
KEYCLOAK_REALM_NAME: str#
KEYCLOAK_SERVER_URL: Optional[str]#
KEYCLOAK_TOKEN_URL: Optional[str]#
MAX_UPLOAD_SIZE_GB: Union[int, float]#
MINIO_API_ACCESS_KEY: Optional[str]#
MINIO_API_HOST: Optional[str]#
MINIO_API_SECRET_KEY: Optional[str]#
MINIO_BUCKET_NAME: str#
MINIO_DSN: Optional[str]#
MINIO_TLS: bool#
MONGO_DSN: Optional[MongoDsn]#
MONGO_PASSWORD: Optional[str]#
MONGO_USERNAME: Optional[str]#
SECRET_KEY: Optional[str]#
SECURE_COOKIES: bool#
_abc_impl = <_abc._abc_data object>#
classmethod assemble_cors_origins(v: Union[str, List[str]]) Union[List[str], str][source]#

Convert a string array of the frontend origins to an actual array

Parameters:

v (Union[str, List[str]]) – _description_

Raises:

ValueError – _description_

Returns:

_description_

Return type:

Union[List[str], str]

set_envvar()[source]#

Temporarily set environment variables. This change will not be permanent, so no need to worry about overriding system envvars.

class src.config.config.ProductionConfig(_env_file: Optional[Union[str, PathLike, List[Union[str, PathLike]], Tuple[Union[str, PathLike], ...]]] = '<object object>', _env_file_encoding: Optional[str] = None, _env_nested_delimiter: Optional[str] = None, _secrets_dir: Optional[Union[str, PathLike]] = None, *, ENV_STATE: Environment = Environment.DEV, FRONTEND_HOST: List[AnyHttpUrl] = [], MAX_UPLOAD_SIZE_GB: Union[int, float] = 10, SECURE_COOKIES: bool = False, ALGORITHM: str = 'HS256', SECRET_KEY: Optional[str] = None, DB_NAME: str = 'appStoreDB', MONGO_DSN: Optional[MongoDsn] = None, MONGO_USERNAME: Optional[str] = None, MONGO_PASSWORD: Optional[str] = None, MINIO_DSN: Optional[str] = None, MINIO_API_HOST: Optional[str] = None, MINIO_BUCKET_NAME: str = 'model-zoo', MINIO_TLS: bool = False, MINIO_API_ACCESS_KEY: Optional[str] = None, MINIO_API_SECRET_KEY: Optional[str] = None, IE_NAMESPACE: Optional[str] = None, IE_SERVICE_TYPE: ServiceBackend = ServiceBackend.EMISSARY, IE_DEFAULT_PROTOCOL: str = 'http', IE_DOMAIN: Optional[str] = None, IE_INGRESS_NAME: Optional[str] = None, IE_INGRESS_NAMESPACE: Optional[str] = None, K8S_HOST: Optional[str] = None, K8S_API_KEY: Optional[str] = None, CLEARML_CONFIG_FILE: Optional[str] = None, CLEARML_WEB_HOST: Optional[str] = None, CLEARML_API_HOST: Optional[str] = None, CLEARML_FILES_HOST: Optional[str] = None, CLEARML_API_ACCESS_KEY: Optional[str] = None, CLEARML_API_SECRET_KEY: Optional[str] = None, KEYCLOAK_SERVER_URL: Optional[str] = None, KEYCLOAK_REALM_NAME: str = 'CommonServices', KEYCLOAK_CLIENT_ID: str = 'ai-appstore-backend', KEYCLOAK_CLIENT_SECRET_KEY: Optional[str] = None, KEYCLOAK_AUTHORIZATION_URL: Optional[str] = None, KEYCLOAK_TOKEN_URL: Optional[str] = None)[source]#

Bases: GlobalConfig

Production configuration. Inherits from GlobalConfig, using environment variables that start with PROD_ as the default values.

ALGORITHM: str#
CLEARML_API_ACCESS_KEY: Optional[str]#
CLEARML_API_HOST: Optional[str]#
CLEARML_API_SECRET_KEY: Optional[str]#
CLEARML_CONFIG_FILE: Optional[str]#
CLEARML_FILES_HOST: Optional[str]#
CLEARML_WEB_HOST: Optional[str]#
class Config[source]#

Bases: object

Pydantic config class.

env_prefix: str = 'PROD_'#
DB_NAME: str#
ENV_STATE: Environment#
FRONTEND_HOST: List[AnyHttpUrl]#
IE_DEFAULT_PROTOCOL: str#
IE_DOMAIN: Optional[str]#
IE_INGRESS_NAME: Optional[str]#
IE_INGRESS_NAMESPACE: Optional[str]#
IE_NAMESPACE: Optional[str]#
IE_SERVICE_TYPE: ServiceBackend#
K8S_API_KEY: Optional[str]#
K8S_HOST: Optional[str]#
KEYCLOAK_AUTHORIZATION_URL: Optional[str]#
KEYCLOAK_CLIENT_ID: str#
KEYCLOAK_CLIENT_SECRET_KEY: Optional[str]#
KEYCLOAK_REALM_NAME: str#
KEYCLOAK_SERVER_URL: Optional[str]#
KEYCLOAK_TOKEN_URL: Optional[str]#
MAX_UPLOAD_SIZE_GB: Union[int, float]#
MINIO_API_ACCESS_KEY: Optional[str]#
MINIO_API_HOST: Optional[str]#
MINIO_API_SECRET_KEY: Optional[str]#
MINIO_BUCKET_NAME: str#
MINIO_DSN: Optional[str]#
MINIO_TLS: bool#
MONGO_DSN: Optional[MongoDsn]#
MONGO_PASSWORD: Optional[str]#
MONGO_USERNAME: Optional[str]#
SECRET_KEY: Optional[str]#
SECURE_COOKIES: bool#
_abc_impl = <_abc._abc_data object>#
class src.config.config.StagingConfig(_env_file: Optional[Union[str, PathLike, List[Union[str, PathLike]], Tuple[Union[str, PathLike], ...]]] = '<object object>', _env_file_encoding: Optional[str] = None, _env_nested_delimiter: Optional[str] = None, _secrets_dir: Optional[Union[str, PathLike]] = None, *, ENV_STATE: Environment = Environment.DEV, FRONTEND_HOST: List[AnyHttpUrl] = [], MAX_UPLOAD_SIZE_GB: Union[int, float] = 10, SECURE_COOKIES: bool = False, ALGORITHM: str = 'HS256', SECRET_KEY: Optional[str] = None, DB_NAME: str = 'appStoreDB', MONGO_DSN: Optional[MongoDsn] = None, MONGO_USERNAME: Optional[str] = None, MONGO_PASSWORD: Optional[str] = None, MINIO_DSN: Optional[str] = None, MINIO_API_HOST: Optional[str] = None, MINIO_BUCKET_NAME: str = 'model-zoo', MINIO_TLS: bool = False, MINIO_API_ACCESS_KEY: Optional[str] = None, MINIO_API_SECRET_KEY: Optional[str] = None, IE_NAMESPACE: Optional[str] = None, IE_SERVICE_TYPE: ServiceBackend = ServiceBackend.EMISSARY, IE_DEFAULT_PROTOCOL: str = 'http', IE_DOMAIN: Optional[str] = None, IE_INGRESS_NAME: Optional[str] = None, IE_INGRESS_NAMESPACE: Optional[str] = None, K8S_HOST: Optional[str] = None, K8S_API_KEY: Optional[str] = None, CLEARML_CONFIG_FILE: Optional[str] = None, CLEARML_WEB_HOST: Optional[str] = None, CLEARML_API_HOST: Optional[str] = None, CLEARML_FILES_HOST: Optional[str] = None, CLEARML_API_ACCESS_KEY: Optional[str] = None, CLEARML_API_SECRET_KEY: Optional[str] = None, KEYCLOAK_SERVER_URL: Optional[str] = None, KEYCLOAK_REALM_NAME: str = 'CommonServices', KEYCLOAK_CLIENT_ID: str = 'ai-appstore-backend', KEYCLOAK_CLIENT_SECRET_KEY: Optional[str] = None, KEYCLOAK_AUTHORIZATION_URL: Optional[str] = None, KEYCLOAK_TOKEN_URL: Optional[str] = None)[source]#

Bases: GlobalConfig

Staging configuration. Inherits from GlobalConfig, using environment variables that start with STG_ as the default values.

ALGORITHM: str#
CLEARML_API_ACCESS_KEY: Optional[str]#
CLEARML_API_HOST: Optional[str]#
CLEARML_API_SECRET_KEY: Optional[str]#
CLEARML_CONFIG_FILE: Optional[str]#
CLEARML_FILES_HOST: Optional[str]#
CLEARML_WEB_HOST: Optional[str]#
class Config[source]#

Bases: object

Pydantic config class. Set the environment variable prefix to STG_.

env_prefix: str = 'STG_'#
DB_NAME: str#
ENV_STATE: Environment#
FRONTEND_HOST: List[AnyHttpUrl]#
IE_DEFAULT_PROTOCOL: str#
IE_DOMAIN: Optional[str]#
IE_INGRESS_NAME: Optional[str]#
IE_INGRESS_NAMESPACE: Optional[str]#
IE_NAMESPACE: Optional[str]#
IE_SERVICE_TYPE: ServiceBackend#
K8S_API_KEY: Optional[str]#
K8S_HOST: Optional[str]#
KEYCLOAK_AUTHORIZATION_URL: Optional[str]#
KEYCLOAK_CLIENT_ID: str#
KEYCLOAK_CLIENT_SECRET_KEY: Optional[str]#
KEYCLOAK_REALM_NAME: str#
KEYCLOAK_SERVER_URL: Optional[str]#
KEYCLOAK_TOKEN_URL: Optional[str]#
MAX_UPLOAD_SIZE_GB: Union[int, float]#
MINIO_API_ACCESS_KEY: Optional[str]#
MINIO_API_HOST: Optional[str]#
MINIO_API_SECRET_KEY: Optional[str]#
MINIO_BUCKET_NAME: str#
MINIO_DSN: Optional[str]#
MINIO_TLS: bool#
MONGO_DSN: Optional[MongoDsn]#
MONGO_PASSWORD: Optional[str]#
MONGO_USERNAME: Optional[str]#
SECRET_KEY: Optional[str]#
SECURE_COOKIES: bool#
_abc_impl = <_abc._abc_data object>#
class src.config.config.TestingConfig(_env_file: Optional[Union[str, PathLike, List[Union[str, PathLike]], Tuple[Union[str, PathLike], ...]]] = '<object object>', _env_file_encoding: Optional[str] = None, _env_nested_delimiter: Optional[str] = None, _secrets_dir: Optional[Union[str, PathLike]] = None, *, ENV_STATE: Environment = Environment.DEV, FRONTEND_HOST: List[AnyHttpUrl] = [], MAX_UPLOAD_SIZE_GB: Union[int, float] = 10, SECURE_COOKIES: bool = False, ALGORITHM: str = 'HS256', SECRET_KEY: Optional[str] = None, DB_NAME: str = 'appStoreDB', MONGO_DSN: Optional[MongoDsn] = None, MONGO_USERNAME: Optional[str] = None, MONGO_PASSWORD: Optional[str] = None, MINIO_DSN: Optional[str] = None, MINIO_API_HOST: Optional[str] = None, MINIO_BUCKET_NAME: str = 'model-zoo', MINIO_TLS: bool = False, MINIO_API_ACCESS_KEY: Optional[str] = None, MINIO_API_SECRET_KEY: Optional[str] = None, IE_NAMESPACE: Optional[str] = None, IE_SERVICE_TYPE: ServiceBackend = ServiceBackend.EMISSARY, IE_DEFAULT_PROTOCOL: str = 'http', IE_DOMAIN: Optional[str] = None, IE_INGRESS_NAME: Optional[str] = None, IE_INGRESS_NAMESPACE: Optional[str] = None, K8S_HOST: Optional[str] = None, K8S_API_KEY: Optional[str] = None, CLEARML_CONFIG_FILE: Optional[str] = None, CLEARML_WEB_HOST: Optional[str] = None, CLEARML_API_HOST: Optional[str] = None, CLEARML_FILES_HOST: Optional[str] = None, CLEARML_API_ACCESS_KEY: Optional[str] = None, CLEARML_API_SECRET_KEY: Optional[str] = None, KEYCLOAK_SERVER_URL: Optional[str] = None, KEYCLOAK_REALM_NAME: str = 'CommonServices', KEYCLOAK_CLIENT_ID: str = 'ai-appstore-backend', KEYCLOAK_CLIENT_SECRET_KEY: Optional[str] = None, KEYCLOAK_AUTHORIZATION_URL: Optional[str] = None, KEYCLOAK_TOKEN_URL: Optional[str] = None)[source]#

Bases: GlobalConfig

Testing configuration used for unit tests. Inherits from GlobalConfig, using environment variables that start with TEST_ as the default values.

ALGORITHM: str#
CLEARML_API_ACCESS_KEY: Optional[str]#
CLEARML_API_HOST: Optional[str]#
CLEARML_API_SECRET_KEY: Optional[str]#
CLEARML_CONFIG_FILE: Optional[str]#
CLEARML_FILES_HOST: Optional[str]#
CLEARML_WEB_HOST: Optional[str]#
class Config[source]#

Bases: object

Pydantic config class.

env_prefix: str = 'TEST_'#
DB_NAME: str#
ENV_STATE: Environment#
FRONTEND_HOST: List[AnyHttpUrl]#
IE_DEFAULT_PROTOCOL: str#
IE_DOMAIN: Optional[str]#
IE_INGRESS_NAME: Optional[str]#
IE_INGRESS_NAMESPACE: Optional[str]#
IE_NAMESPACE: Optional[str]#
IE_SERVICE_TYPE: ServiceBackend#
K8S_API_KEY: Optional[str]#
K8S_HOST: Optional[str]#
KEYCLOAK_AUTHORIZATION_URL: Optional[str]#
KEYCLOAK_CLIENT_ID: str#
KEYCLOAK_CLIENT_SECRET_KEY: Optional[str]#
KEYCLOAK_REALM_NAME: str#
KEYCLOAK_SERVER_URL: Optional[str]#
KEYCLOAK_TOKEN_URL: Optional[str]#
MAX_UPLOAD_SIZE_GB: Union[int, float]#
MINIO_API_ACCESS_KEY: Optional[str]#
MINIO_API_HOST: Optional[str]#
MINIO_API_SECRET_KEY: Optional[str]#
MINIO_BUCKET_NAME: str#
MINIO_DSN: Optional[str]#
MINIO_TLS: bool#
MONGO_DSN: Optional[MongoDsn]#
MONGO_PASSWORD: Optional[str]#
MONGO_USERNAME: Optional[str]#
SECRET_KEY: Optional[str]#
SECURE_COOKIES: bool#
_abc_impl = <_abc._abc_data object>#