Small config file
Added a small config file with some variables
This commit is contained in:
parent
82625c9d73
commit
edc3e55ead
6 changed files with 43 additions and 6 deletions
|
@ -5,6 +5,8 @@ from hashlib import sha256
|
|||
from uuid import uuid4 as uuid
|
||||
## Import db class from func.py and initialise it
|
||||
from func import db
|
||||
## import all config variables
|
||||
from config import *
|
||||
db=db()
|
||||
db.startup()
|
||||
|
||||
|
@ -82,7 +84,7 @@ def loginpage():
|
|||
return passhash
|
||||
# if passwords match, create session and return cookie
|
||||
if password.upper() == passhash.upper():
|
||||
lifetime=3000000 # lifetime of the sesskey in seconds
|
||||
lifetime=RAR_COOKIE_LIFETIME # lifetime of the sesskey in seconds
|
||||
sesskey=str(uuid())
|
||||
db.set_sesskey(sesskey,userid,lifetime)
|
||||
resp=setcookie("session",sesskey,lifetime)
|
||||
|
|
6
flask/example.config.py
Normal file
6
flask/example.config.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
MARIADB_USER="rar_index_app"
|
||||
MARIADB_PASSWORD="password"
|
||||
MARIADB_HOST="db"
|
||||
MARIADB_DB="rar_index"
|
||||
|
||||
RAR_COOKIE_LIFETIME=3000000 # cookie lifetime in seconds
|
|
@ -5,10 +5,10 @@ import time,re
|
|||
|
||||
## params populated with environment variables, defaults can be changed for a permanent solution
|
||||
conn_params={
|
||||
"user" : environ.get('MARIADB_USER') if environ.get('MARIADB_USER') else "rar_index_app",
|
||||
"password" : environ.get('MARIADB_PASSWORD') if environ.get('MARIADB_PASSWORD') else "password",
|
||||
"host" : environ.get('MARIADB_HOST') if environ.get('MARIADB_HOST') else "marcelsite.com",
|
||||
"database" : environ.get('MARIADB_DB') if environ.get('MARIADB_DB') else "rar_index"
|
||||
"user" : environ.get('MARIADB_USER') if environ.get('MARIADB_USER') else MARIADB_USER,
|
||||
"password" : environ.get('MARIADB_PASSWORD') if environ.get('MARIADB_PASSWORD') else MARIADB_PASSWORD,
|
||||
"host" : environ.get('MARIADB_HOST') if environ.get('MARIADB_HOST') else MARIADB_HOST,
|
||||
"database" : environ.get('MARIADB_DB') if environ.get('MARIADB_DB') else MARIAD_DB
|
||||
}
|
||||
|
||||
class db:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue