create build-time random string for SECRET_KEY for prod
This commit is contained in:
13
main.py
13
main.py
@@ -29,9 +29,16 @@ app = Flask(__name__)
|
||||
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = DB_URL
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
app.config['ENV'] = os.environ['ENV']
|
||||
app.config['SECRET_KEY'] = b'my_insecure_PA_token_with_random_2134876adsfjhlkasdf87'
|
||||
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 31536000
|
||||
app.config['ENV'] = os.environ['ENV']
|
||||
# if in prod, Dockerfile will generate a random string and place it in /code/.sk
|
||||
try:
|
||||
with open('/code/.sk') as f:
|
||||
app.config['SECRET_KEY'] = f.read()
|
||||
except Exception:
|
||||
app.config['SECRET_KEY'] = b'my_insecure_PA_token_with_random_2134876adsfjhlkasdf87'
|
||||
|
||||
print(app.config['SECRET_KEY'])
|
||||
|
||||
# ldap config vars: (the last one is required, or python ldap freaks out)
|
||||
app.config['LDAP_HOST'] = 'mara.ddp.net'
|
||||
@@ -55,7 +62,7 @@ Compress(app)
|
||||
|
||||
|
||||
################################# Now, import separated class files ###################################
|
||||
from ai import aistats
|
||||
from ai import ai_stats
|
||||
from files import Entry
|
||||
from person import Person
|
||||
from settings import Settings
|
||||
|
||||
Reference in New Issue
Block a user