-
Notifications
You must be signed in to change notification settings - Fork 19
/
config_manager.py
34 lines (28 loc) · 1.21 KB
/
config_manager.py
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
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The American Gut Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------
import json
# NOTE: importlib replaces setuptools' pkg_resources as of Python 3.7
# See: https://stackoverflow.com/questions/6028000/how-to-read-a-static-file-from-inside-a-python-package # noqa
import importlib.resources as pkg_resources
class DBConfig(object):
def __init__(self):
self.user = 'postgres'
self.password = 'postgres'
self.database = 'ag_test'
self.host = 'localhost'
self.port = 5432
self.project_name = "PROJECT_NAME"
self.project_shorthand = "PROJECT_SHORTHAND"
self.sitebase = "PROJECT_SITEBASE"
self.locale = "american_gut"
AMGUT_CONFIG = DBConfig()
with pkg_resources.open_text('microsetta_private_api', "server_config.json") \
as fp:
SERVER_CONFIG = json.load(fp)
SERVER_CONFIG['vioscreen_cryptokey'] = \
SERVER_CONFIG['vioscreen_cryptokey'].encode('ascii')