added utility functions

This commit is contained in:
Brian Bjarke Jensen
2024-05-21 19:14:49 +02:00
parent 1579b15b4e
commit d516578d4b
2 changed files with 28 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
from __future__ import annotations
from .check_env import check_env
+25
View File
@@ -0,0 +1,25 @@
"""Definition of check_env function."""
from __future__ import annotations
import os
def check_env() -> None:
"""Check necessary environment variables are set."""
necesasary_var_list = {
'MONGO_HOST',
'MONGO_DB',
'MONGO_COLLECTION',
'MONGO_USER',
'MONGO_PASSWORD',
'MINIO_ENDPOINT',
'MINIO_ACCESS_KEY',
'MINIO_SECRET_KEY',
}
for env_var in necesasary_var_list:
# ensure env var set
assert (
env_var in os.environ
), (
f"environment variable not set: {env_var}"
)