diff options
Diffstat (limited to 'animism-align/cli/app/settings')
| -rw-r--r-- | animism-align/cli/app/settings/__pycache__/app_cfg.cpython-37.pyc | bin | 0 -> 1531 bytes | |||
| -rw-r--r-- | animism-align/cli/app/settings/app_cfg.py | 90 |
2 files changed, 90 insertions, 0 deletions
diff --git a/animism-align/cli/app/settings/__pycache__/app_cfg.cpython-37.pyc b/animism-align/cli/app/settings/__pycache__/app_cfg.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..f153ad1 --- /dev/null +++ b/animism-align/cli/app/settings/__pycache__/app_cfg.cpython-37.pyc diff --git a/animism-align/cli/app/settings/app_cfg.py b/animism-align/cli/app/settings/app_cfg.py new file mode 100644 index 0000000..0a33b50 --- /dev/null +++ b/animism-align/cli/app/settings/app_cfg.py @@ -0,0 +1,90 @@ +import os +from os.path import join +import collections +import logging + +from dotenv import load_dotenv +import yaml + +# from app.models import types +from pathlib import Path + +import codecs +codecs.register(lambda name: codecs.lookup('utf8') if name == 'utf8mb4' else None) + +LOG = logging.getLogger('swimmer') + +# ----------------------------------------------------------------------------- +# .env config for keys +# ----------------------------------------------------------------------------- +# Project directory +SELF_CWD = os.path.dirname(os.path.realpath(__file__)) # this file +DIR_PROJECT_ROOT = str(Path(SELF_CWD).parent.parent.parent) + +# source .env vars +fp_env = join(DIR_PROJECT_ROOT, '.env') +load_dotenv(dotenv_path=fp_env) +# VFRAME_PRODUCTION = os.getenv('VFRAME_ENV') == 'production' + +# ----------------------------------------------------------------------------- +# Click config +# ----------------------------------------------------------------------------- + +CLICK_GROUPS = { + 'peaks': 'commands/peaks', + 'db': '', + 'flask': '', +} + + +# ----------------------------------------------------------------------------- +# File I/O +# ----------------------------------------------------------------------------- + +SELF_CWD = os.path.dirname(os.path.realpath(__file__)) # Script CWD +DIR_APP = str(Path(SELF_CWD).parent.parent.parent) + +DIR_DATA_STORE = join(DIR_APP, 'data_store') + +DIR_DATABASE = join(DIR_DATA_STORE, 'db') +DIR_UPLOADS = join(DIR_DATA_STORE, 'uploads') +DIR_EXPORTS = join(DIR_DATA_STORE, 'exports') + +DIR_DOCS = join(DIR_APP, 'docs') + +URL_DATA = '/static/data/' +URL_MEDIA = join(URL_DATA, 'media') +URL_UPLOADS = join(URL_DATA, 'uploads') +URL_EXPORTS = join(URL_DATA, 'exports') + +if 'cli' in os.getcwd(): + DIR_STATIC = os.path.abspath('../static') +else: + DIR_STATIC = os.path.abspath('static') + +HASH_TREE_DEPTH = 3 # for sha256 subdirs +HASH_BRANCH_SIZE = 3 # for sha256 subdirs + + +# ----------------------------------------------------------------------------- +# S3 storage +# ----------------------------------------------------------------------------- + +try: + S3_HTTP_BASE_URL = os.getenv("S3_HTTP_BASE_URL") +except Exception as e: + pass + +# ----------------------------------------------------------------------------- +# Exports +# ----------------------------------------------------------------------------- + +SERVER_NAME = os.getenv('SERVER_NAME') or '0.0.0.0:5000' +HTTP_EXTERNAL_HOST = os.getenv('HTTP_EXTERNAL_HOST') or f"http://{SERVER_NAME}" + +# ----------------------------------------------------------------------------- +# Unicode symbols for logger +# ----------------------------------------------------------------------------- + +UCODE_OK = u"\u2714" # check ok +UCODE_NOK = u'\u2718' # x no ok
\ No newline at end of file |
