env
dev_tool.config.env
log = logging.getLogger(__name__)
module-attribute
EnvConfig
A class for managing environment configuration.
This class provides methods for loading, reloading, and creating default environment variable configurations.
reload
A method that reloads environment variables from a .env file.
This method loads environment variables from the specified file path, overriding any existing variables with the same names.
Parameters:
-
dotenv_path(Path | str | None, default:None) –The path to the .env file to load.
-
prompt(bool, default:False) –Whether to prompt the user for the env file path.
Source code in dev_tool/config/env.py
create_default_env
A method that creates a default environment file.
This method copies the content from a template file to create a new environment configuration file if it doesn't already exist.
Parameters:
-
path(Path) –The path where the new environment file should be created.
-
template(Path) –The path to the template environment file.
Source code in dev_tool/config/env.py
get_docker_authorization
A method that retrieves Docker authorization credentials.
This method gets the username and password for Docker from environment variables, falling back to default values if not set.
Returns:
Raises:
-
OSError–If the username or password is empty.