Load environment variable as int :param name: name of the environment variable :param required: whether the environment variable is required
(name: str, required: bool = False)
| 33 | |
| 34 | |
| 35 | def load_int_env(name: str, required: bool = False) -> int: |
| 36 | """ |
| 37 | Load environment variable as int |
| 38 | :param name: name of the environment variable |
| 39 | :param required: whether the environment variable is required |
| 40 | """ |
| 41 | if os.environ.get(name): |
| 42 | return int(os.environ.get(name)) |
| 43 | |
| 44 | if default_env_values.get(name) is not None: |
| 45 | return default_env_values.get(name) |
| 46 | |
| 47 | if required: |
| 48 | raise Exception(f"Env {name} is not set") |
| 49 | |
| 50 | |
| 51 | class Config: |