Skip to content

AMSDAL configuration

This configuration is used by AMSDAL Framework during initialization. These configs can be set via environment variables prefixed with AMSDAL_

amsdal.configs.main.Settings

Bases: BaseSettings

Configuration settings for the application.

This class defines the configuration settings for the application, including paths, environment variables, and other settings.

Attributes: model_config (SettingsConfigDict): Configuration for the settings model. APP_PATH (Path): Path to the app directory where the generated models and other files will be placed. CONFIG_PATH (Path | None): Path to the config.yml file. If not specified, the default APP_PATH/config.yml file will be used. MODELS_MODULE_NAME (str): The models module name. The generated models will be placed in this module. SCHEMAS_MODULE_NAME (str): The schemas module name. The schemas will be placed in this module. FIXTURES_MODULE_NAME (str): The fixtures module name. The fixtures will be placed in this module. STATIC_MODULE_NAME (str): The static module name. The static files will be placed in this module. TRANSACTIONS_MODULE_NAME (str): The transactions module name. The transactions will be placed in this module. MIGRATIONS_DIRECTORY_NAME (str): The migrations directory name. The migration files will be placed in this folder. ACCESS_KEY_ID (str | None): The access key that you will get during registering process. SECRET_ACCESS_KEY (str | None): The secret access key that you will get during registering process. ACCESS_TOKEN (str | None): The access token that you will get during sign in process. SANDBOX_ENVIRONMENT (bool | None): If True, the sandbox environment will be used. If False, the cloud environment will be used. CONTRIBS (list[str]): List of contrib modules that will be loaded and used. Can be specified via environment variable AMSDAL_CONTRIBS as comma separated string.

load_contrib_modules

load_contrib_modules(value)

Loads and initializes contrib modules.

This method takes a list of contrib module paths, imports each module, and calls the on_ready method of the AppConfig class within each module.

Args: value (list[str]): A list of contrib module paths in the format 'package.module.ClassName'.

Returns: list[str]: The same list of contrib module paths after loading and initializing the modules.

models_root_path property

models_root_path

Returns the root path for models.

This property constructs and returns the path to the models directory based on the APP_PATH and MODELS_MODULE_NAME attributes.

Returns: Path: The root path for the models directory.

schemas_root_path property

schemas_root_path

Returns the root path for schemas.

This property constructs and returns the path to the schemas directory based on the APP_PATH and SCHEMAS_MODULE_NAME attributes.

Returns: Path: The root path for the schemas directory.

fixtures_root_path property

fixtures_root_path

Returns the root path for fixtures.

This property constructs and returns the path to the fixtures directory based on the APP_PATH and FIXTURES_MODULE_NAME attributes.

Returns: Path: The root path for the fixtures directory.

static_root_path property

static_root_path

Returns the root path for static files.

This property constructs and returns the path to the static files directory based on the APP_PATH and STATIC_MODULE_NAME attributes.

Returns: Path: The root path for the static files directory.

transactions_root_path property

transactions_root_path

Returns the root path for transactions.

This property constructs and returns the path to the transactions directory based on the models_root_path and TRANSACTIONS_MODULE_NAME attributes.

Returns: Path: The root path for the transactions directory.

migrations_root_path property

migrations_root_path

Returns the root path for migrations.

This property constructs and returns the path to the migrations directory based on the models_root_path and MIGRATIONS_DIRECTORY_NAME attributes.

Returns: Path: The root path for the migrations directory.

check_passwords_match

check_passwords_match()

Ensures the configuration path is set.

This method checks if the CONFIG_PATH attribute is set. If it is not set, it assigns a default path based on the APP_PATH attribute.

Returns: Settings: The updated settings instance with the CONFIG_PATH attribute set.