added utility functions
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from .check_env import check_env
|
||||||
@@ -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}"
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user