summaryrefslogtreecommitdiff
path: root/check/app/settings/app_cfg.py
blob: ce5b5d823bf88c74e0c217792cac578efab4c24b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import os
from os.path import join
import logging
import collections
from dotenv import load_dotenv

from app.settings import types
from app.utils import click_utils
from pathlib import Path

import codecs
codecs.register(lambda name: codecs.lookup('utf8') if name == 'utf8mb4' else None)

# -----------------------------------------------------------------------------
# click settings
# -----------------------------------------------------------------------------
DIR_COMMANDS_PHASH = 'commands/phash'

# -----------------------------------------------------------------------------
# S3 storage
# -----------------------------------------------------------------------------
S3_ROOT_URL = 's3://check-vframe/v1/'
S3_METADATA_URL = join(S3_ROOT_URL, 'metadata')
S3_HTTP_URL = 'https://check-vframe.nyc3.digitaloceanspaces.com/v1/'
S3_HTTP_METADATA_URL = join(S3_HTTP_URL, 'metadata')

# -----------------------------------------------------------------------------
# Celery
# -----------------------------------------------------------------------------
CELERY_BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'

# -----------------------------------------------------------------------------
# Logging options exposed for custom click Params
# -----------------------------------------------------------------------------
LOGGER_NAME = 'app'
LOGLEVELS = {
  types.LogLevel.DEBUG: logging.DEBUG,
  types.LogLevel.INFO: logging.INFO,
  types.LogLevel.WARN: logging.WARN,
  types.LogLevel.ERROR: logging.ERROR,
  types.LogLevel.CRITICAL: logging.CRITICAL
}
LOGLEVEL_OPT_DEFAULT = types.LogLevel.DEBUG.name
#LOGFILE_FORMAT = "%(asctime)s: %(levelname)s: %(message)s"
#LOGFILE_FORMAT = "%(levelname)s:%(name)s: %(message)s"
#LOGFILE_FORMAT = "%(levelname)s: %(message)s"
#LOGFILE_FORMAT = "%(filename)s:%(lineno)s  %(funcName)s()  %(message)s"
# colored logs
"""
black, red, green, yellow, blue, purple, cyan and white.
{color}, fg_{color}, bg_{color}: Foreground and background colors.
bold, bold_{color}, fg_bold_{color}, bg_bold_{color}: Bold/bright colors.
reset: Clear all formatting (both foreground and background colors).
"""
LOGFILE_FORMAT = "%(log_color)s%(levelname)-8s%(reset)s %(cyan)s%(filename)s:%(lineno)s:%(bold_cyan)s%(funcName)s() %(reset)s%(message)s"

LogLevelVar = click_utils.ParamVar(types.LogLevel)

# -----------------------------------------------------------------------------
# Filesystem settings
# hash trees enforce a maximum number of directories per directory
# -----------------------------------------------------------------------------
ZERO_PADDING = 6  # padding for enumerated image filenames
#FRAME_NAME_ZERO_PADDING = 6  # is this active??
CKPT_ZERO_PADDING = 9
HASH_TREE_DEPTH = 3
HASH_BRANCH_SIZE = 3

# -----------------------------------------------------------------------------
# .env config for keys
# -----------------------------------------------------------------------------
# DIR_DOTENV = join(DIR_APP, '.env')
load_dotenv() # dotenv_path=DIR_DOTENV)