Skip to content

Commit

Permalink
Refactored configs file
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Balestri committed Jul 8, 2021
1 parent cbdcae6 commit 12b494d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
@@ -1,5 +1,5 @@
#!/usr/bin/env python3

LOG_FILE = "logs/knowage-python.log"
HMACKEY_FILE = "hmackey"
LOG_FORMAT = "[%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s"
LOG_FORMAT = "[%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s"
HMACKEY_FILE = "hmackey"
4 changes: 2 additions & 2 deletions Knowage-Python/src/app/utilities/security.py
Expand Up @@ -18,7 +18,7 @@

import jwt
from datetime import datetime
from app.utilities import constants
from app.utilities import configs

def jwt_token_to_python_script(token):
try:
Expand All @@ -34,6 +34,6 @@ def jwt_token_to_python_script(token):
return True, script

def get_hmac_key():
with open(constants.HMACKEY_FILE, "rb") as f:
with open(configs.HMACKEY_FILE, "rb") as f:
key = f.read()
return key
6 changes: 3 additions & 3 deletions Knowage-Python/src/knowage-python.py
Expand Up @@ -2,10 +2,10 @@

import sys
from app.services import create_app
from app.utilities import constants
from app.utilities import configs
import logging

logging.basicConfig(format=constants.LOG_FORMAT, level=logging.WARNING)
logging.basicConfig(format=configs.LOG_FORMAT, level=logging.WARNING)
#logging.basicConfig(filename=constants.LOG_FILE, filemode='w', format=constants.LOG_FORMAT, level=logging.WARNING)

application = create_app()
Expand All @@ -15,7 +15,7 @@
port = int(sys.argv[1])
else:
port = 5000
open(constants.LOG_FILE, 'w+').close() #clean log file
open(configs.LOG_FILE, 'w+').close() #clean log file
original_stderr = sys.stderr
#sys.stderr = open(constants.LOG_FILE, 'a')
application.run(host='0.0.0.0', debug=False, port=port)
Expand Down

0 comments on commit 12b494d

Please sign in to comment.