File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: UTF-8 -*-
2
2
3
+ from os import environ
3
4
from os .path import abspath , dirname , join
4
5
from time import strftime
5
6
36
37
HOST = "127.0.0.1" # Dev
37
38
# HOST = "0.0.0.0" # Production
38
39
PORT = 4000
39
- SECRET_KEY = "12345" # TODO: move out the sensitive data
40
+ SECRET_KEY = environ . get ( "FLASKAPP_KEY" )
40
41
41
42
LOGGING = True
42
43
LOG_FILE = join (LOG_DIR , "flaskapp_{}.log" .format (strftime (TIMESTAMP_FORMAT ).replace (' ' , '_' )))
Original file line number Diff line number Diff line change 8
8
from application .misc import parse_arguments , setup_logging
9
9
from application .shared .filesystem import ensure_dir
10
10
11
- from config import LOG_DIR , HOST , PORT
11
+ from config import LOG_DIR , HOST , PORT , SECRET_KEY
12
12
13
13
14
14
def main () -> int :
@@ -19,6 +19,9 @@ def main() -> int:
19
19
ensure_dir (LOG_DIR )
20
20
log_level = DEBUG if args .verbose else INFO
21
21
setup_logging (app , log_level )
22
+ if SECRET_KEY is None :
23
+ app .logger .error ("Setup you FLASKAPP_KEY environment variable first in order to run the application!" )
24
+ return ExitCode .FAILURE .value
22
25
# Run server
23
26
app .run (host = HOST , port = PORT , debug = DEBUG )
24
27
You can’t perform that action at this time.
0 commit comments