es_sfgtools.config.env_config module

This module manages environment-specific configurations.

It defines a class Environment that detects the current working environment (e.g., LOCAL or GEOLAB) and loads relevant settings from environment variables.

class es_sfgtools.config.env_config.Environment

Bases: object

A class to manage and provide access to environment-specific settings.

This class should not be instantiated. It provides its functionality through class methods.

classmethod load_aws_credentials() None

Loads AWS credentials from environment variables.

This method checks for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables and sets them for use with AWS SDKs.

Raises:

Warning – If either of the required AWS credentials is not set.

classmethod load_working_environment() None

Loads configuration from environment variables.

This method checks for WORKING_ENVIRONMENT, S3_SYNC_BUCKET, and MAIN_DIRECTORY_GEOLAB and sets the class-level attributes accordingly.

Raises:

ValueError – If the environment is set to GEOLAB but the required directory is not specified, or if an unknown environment is specified.

classmethod main_directory_GEOLAB() str | None

Returns the main directory for the GEOLAB environment, if configured.

classmethod s3_sync_bucket() str | None

Returns the S3 sync bucket name, if configured.

classmethod working_environment() WorkingEnvironment

Returns the current working environment.

class es_sfgtools.config.env_config.WorkingEnvironment(value)

Bases: Enum

Enumeration for the possible working environments.

GEOLAB = 'GEOLAB'
LOCAL = 'LOCAL'