moved webui and updated poetry packages
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from .check_env import check_env
|
||||
from .setup_logging import setup_logging
|
||||
@@ -0,0 +1,24 @@
|
||||
"""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',
|
||||
'DASH_AUTH_USERNAME',
|
||||
'DASH_AUTH_PASSWORD',
|
||||
}
|
||||
for env_var in necesasary_var_list:
|
||||
# ensure env var set
|
||||
assert (
|
||||
env_var in os.environ
|
||||
), (
|
||||
f"environment variable not set: {env_var}"
|
||||
)
|
||||
@@ -0,0 +1,21 @@
|
||||
"""Definition of setup_logging function."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
|
||||
def setup_logging() -> None:
|
||||
"""Setup logging."""
|
||||
requested_log_level = os.getenv('LOG_LEVEL', default='info')
|
||||
level = getattr(logging, requested_log_level.upper())
|
||||
fmt = (
|
||||
'%(asctime)s | '
|
||||
'%(levelname)s | '
|
||||
'%(filename)s | '
|
||||
'%(funcName)s | '
|
||||
'%(message)s'
|
||||
)
|
||||
datefmt = '%Y-%m-%d %H:%M:%S'
|
||||
logging.basicConfig(format=fmt, datefmt=datefmt, level=level)
|
||||
logging.debug('finished')
|
||||
Reference in New Issue
Block a user