Add secret key
This commit is contained in:
parent
56d12cd74b
commit
229441ee32
3 changed files with 17 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
.vagrant
|
||||
.secret_key
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
from flask import Flask
|
||||
import sys
|
||||
import config
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = config.SECRET
|
||||
|
||||
#Home Page
|
||||
@app.route("/")
|
||||
|
|
14
server/config.py
Normal file
14
server/config.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
import os
|
||||
|
||||
with open(".secret_key", "a+") as secret:
|
||||
if not secret.read():
|
||||
secret.seek(0)
|
||||
key = os.urandom(128)
|
||||
secret.write(key)
|
||||
secret.flush()
|
||||
else:
|
||||
key = secret.read()
|
||||
|
||||
SECRET = key
|
||||
CTF_BEGIN = 0 # To be used later
|
||||
CTF_END = 0 # To be used later
|
Loading…
Reference in a new issue