-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from mgorsk1/improvement/new_config_approach
♻️ existing code
- Loading branch information
Showing
10 changed files
with
53 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
from json import loads | ||
from os import path, getenv | ||
from app.logger import prepare | ||
from os import path | ||
from piny import YamlLoader | ||
from types import SimpleNamespace | ||
|
||
from .logger import prepare | ||
|
||
env = getenv('ENV', 'local') | ||
class NestedNamespace(SimpleNamespace): | ||
def __init__(self, dictionary, **kwargs): | ||
super().__init__(**kwargs) | ||
for key, value in dictionary.items(): | ||
if isinstance(value, dict): | ||
self.__setattr__(key, NestedNamespace(value)) | ||
else: | ||
self.__setattr__(key, value) | ||
|
||
|
||
BASE_PATH = path.dirname(__file__) + '/..' | ||
|
||
with open('{}/config/app/{}.json'.format(BASE_PATH, env), 'r') as f: | ||
config = loads(f.read()) | ||
config = NestedNamespace(YamlLoader(path='{}/config/application/application.yaml'.format(BASE_PATH)).load()) | ||
|
||
log = prepare('DEBUG', '/tmp', 'VideoAnalysis') | ||
log = prepare(config.log.level.upper(), '/tmp', 'VideoAnalysis') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
resultDb: | ||
connection: | ||
scheme: ${RESULT_DB_CONN_SCHEME:-http} | ||
host: ${RESULT_DB_CONN_HOST:-localhost} | ||
port: ${RESULT_DB_CONN_PORT:-9200} | ||
auth: | ||
user: ${RESULT_DB_CONN_AUTH_USER} | ||
password: ${RESULT_DB_CONN_AUTH_PASSWORD} | ||
|
||
temporaryDb: | ||
connection: | ||
scheme: ${RESULT_DB_CONN_SCHEME:-http} | ||
host: ${TEMPORARY_DB_CONN_HOST:-localhost} | ||
port: ${TEMPORARY_DB_CONN_PORT:-6379} | ||
auth: | ||
user: ${TEMPORARY_DB_CONN_AUTH_USER} | ||
password: ${TEMPORARY_DB_CONN_AUTH_PASSWORD} | ||
|
||
pushover: | ||
appToken: ${PUSHOVER_APP_TOKEN} | ||
userKey: ${PUSHOVER_USER_KEY} | ||
|
||
log: | ||
level: ${LOG_LEVEL:-info} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ rsa==4.0 | |
six==1.12.0 | ||
soupsieve==1.7.3 | ||
urllib3==1.24.2 | ||
piny==0.6.0 |