@@ -37,6 +37,16 @@ def get_sys_exec_root_or_drive():
37
37
if not all ([algolia_app_id , algolia_api_key ]):
38
38
print ("Application requires 'ALGOLIA_APP_ID' and 'ALGOLIA_API_KEY' for search" )
39
39
40
+
41
+ secret_key = os .environ .get ('SECRET_KEY' )
42
+
43
+ security_password_hash = 'pbkdf2_sha512'
44
+ # Replace this with your own salt.
45
+ security_password_salt = os .environ .get ('SECURITY_PASSWORD_SALT' )
46
+ if not all ([secret_key , security_password_salt ]):
47
+ raise KeyError ("Keys'SECRET_KEY' and 'SECURITY_PASSWORD_SALT' missing" )
48
+
49
+
40
50
index_name = os .environ .get ("INDEX_NAME" )
41
51
42
52
@@ -45,12 +55,9 @@ class Config:
45
55
46
56
SQLALCHEMY_DATABASE_URI = f"postgresql://{ pg_user } :{ pg_pw } @{ pg_host } :5432/{ pg_db } "
47
57
48
- SECRET_KEY = os .urandom (24 )
49
- # Set config values for Flask-Security.
50
- # We're using PBKDF2 with salt.
51
- SECURITY_PASSWORD_HASH = 'pbkdf2_sha512'
52
- # Replace this with your own salt.
53
- SECURITY_PASSWORD_SALT = os .urandom (140 )
58
+ SECRET_KEY = secret_key
59
+ SECURITY_PASSWORD_HASH = security_password_hash
60
+ SECURITY_PASSWORD_SALT = security_password_salt
54
61
55
62
ALGOLIA_APP_ID = algolia_app_id
56
63
ALGOLIA_API_KEY = algolia_api_key
0 commit comments