summaryrefslogtreecommitdiff
path: root/animism-align/cli/app/settings/app_cfg.py
blob: dfd015432433ad80965dae41666c128da0c20340 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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',
  'site': 'commands/site',
  'db': '',
  'flask': '',
  'viewer': '',
}

# -----------------------------------------------------------------------------
# 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')

DIR_STATIC_SITE_VIEWER = join(DIR_DATA_STORE, 'exports/animism')

HASH_TREE_DEPTH = 3  # for sha256 subdirs
HASH_BRANCH_SIZE = 3  # for sha256 subdirs

# -----------------------------------------------------------------------------
# Database
# -----------------------------------------------------------------------------

USE_SQLITE = os.getenv("USE_SQLITE") == "True"

# -----------------------------------------------------------------------------
# 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

# -----------------------------------------------------------------------------
# Vimeo API
# -----------------------------------------------------------------------------

VIMEO_ACCESS_TOKEN = "9dc32c0a13b05e59527661cf0c69ad5d0896d99b"
VIMEO_CLIENT_ID = "qJgeYR1j7uu92BOdt+Kwp3hyeaGZbG8HUrGIqAAN0Lv79rsxzdQu7F/WyO2SgCXNHiz4tB6NAC0IQkV0XerWn9fiHurhO9DC/39uhF6I4T3o5TH0LJOWx5GKPLVryruM"
VIMEO_CLIENT_SECRET = "588aa1d15488d5b32d499ea76a03d9de"

# -----------------------------------------------------------------------------
# Exporter / string builder
# -----------------------------------------------------------------------------

ROMAN_NUMERALS = [
  'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X',
  'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX',
]
TEXT_ANNOTATION_TYPES = [
  'section_heading',
  # 'heading_text',
  'sentence',
  # 'paragraph_end',
  # 'pullquote_credit',
  'footnote',
  # 'text_plate',
  # 'subtitle',
]

IMAGE_UPLOAD_FIELDS = [
  "display", "thumbnail",
  # "fullsize",
]

IMAGE_UPLOAD_GALLERY_LOOKUPS = [
  "thumbnail_lookup", "display_lookup",
  # "image_lookup",
]