Skip to content

Commit

Permalink
no more hardcoded file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
maaaaz committed Jan 21, 2018
1 parent 705dc29 commit 11bbcad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions components/interface/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def genCSRFToken():


CSRF_TOKEN_INDEX = '_csrft'
STATIC_ENDPOINT = 'static'

STATIC_ENDPOINT = os.path.join(os.path.dirname(__file__), 'static')
TEMPLATES_FOLDER = os.path.join(os.path.dirname(__file__), 'templates')

def getCSRFToken():
if not CSRF_TOKEN_INDEX in session:
Expand All @@ -96,7 +96,7 @@ def getCSRFToken():

''' APPLICATION CONFIGURATION '''

app = Flask(__name__, static_folder=STATIC_ENDPOINT)
app = Flask(__name__, static_folder=STATIC_ENDPOINT, template_folder=TEMPLATES_FOLDER)
app.secret_key = os.urandom(24)

app.jinja_env.globals['csrf_token'] = getCSRFToken
Expand Down Expand Up @@ -136,13 +136,14 @@ def decorated(*args, **kwargs):
# Preventing Flask from running Bokeh twice
# source : https://stackoverflow.com/questions/9449101/how-to-stop-flask-from-initialising-twice-in-debug-mode
if not DEBUG or os.environ.get('WERKZEUG_RUN_MAIN') == 'true':
bokeh_process = subprocess.Popen([
cmd = [
'bokeh',
'serve', 'crossbokeh.py',
'serve', "%s" % os.path.abspath(os.path.join(__file__, '../../../crossbokeh.py')),
'--address', BOKEH_LISTEN_ADDRESS,
'--port', str(BOKEH_LISTEN_PORT),
'--allow-websocket-origin', '%s:%d' % (BOKEH_LISTEN_ADDRESS, BOKEH_LISTEN_PORT),
], stdout=subprocess.PIPE)
]
bokeh_process = subprocess.Popen(cmd, stdout=subprocess.PIPE)

@atexit.register
def kill_server():
Expand Down
6 changes: 3 additions & 3 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@

# SSL configuration
USE_SSL = False
SSL_KEY_FILE = os.path.join('ssl','server.pem.key')
SSL_CERT_FILE = os.path.join('ssl','server.pem.cer')
SSL_KEY_FILE = os.path.join(os.path.dirname(__file__), 'ssl', 'server.pem.key')
SSL_CERT_FILE = os.path.join(os.path.dirname(__file__), 'ssl', 'server.pem.cer')


INTERFACE_HASH_SALT = '' # nocommit
SLEEP = 5 # second interval between database poll
MIN_SUBMIT_INTERVAL = 300 # min second interval between two submissions of same IP address
MIN_RESCAN_INTERVAL = 300 # min second interval between two consecutive scans on same IP address
CERTITUDE_DATABASE = "sqlite:///data.db"
CERTITUDE_DATABASE = "sqlite:///%s" % os.path.join(os.path.dirname(__file__), 'data.db')

# IOC Scanner
# ===========
Expand Down

0 comments on commit 11bbcad

Please sign in to comment.