Skip to content

archaeo_super_prompt.config.env

[docs] module archaeo_super_prompt.config.env

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
"""Secret variables management."""
import os
from dotenv import load_dotenv

load_dotenv()


def getenv_or_throw(var_name: str):
    """Load an environment value from the .env file.

    The program will crash if this values does not exist.
    """
    env_var_value = os.getenv(var_name)
    if env_var_value is None:
        raise Exception(
            f"Environment variable '{var_name}' not set up in the .env file"
        )
    return env_var_value

getenv = os.getenv