diff --git a/src/config/SECRET_KEY b/src/config/SECRET_KEY new file mode 100644 index 0000000..0fabffb --- /dev/null +++ b/src/config/SECRET_KEY @@ -0,0 +1 @@ +b'Dn\xe2\x96\xd9\xe7Z;\xd7;\x03\xbe\xa8J\xc7\xda\xd2\xe6\xfa\xe6HU( ' \ No newline at end of file diff --git a/src/config/config.py b/src/config/config.py new file mode 100644 index 0000000..5fdab08 --- /dev/null +++ b/src/config/config.py @@ -0,0 +1,19 @@ +import os +import random +import string + +SECRET_KEY_FILE = './src/config/SECRET_KEY' + +def get_secret_key(): + if os.path.isfile(SECRET_KEY_FILE): + # read the secret key from the file + with open(SECRET_KEY_FILE, 'r') as file: + secret_key = file.read().strip() + return secret_key + else: + # generate a new secret key + secret_key = os.urandom(24) + # save it to the file + with open(SECRET_KEY_FILE, 'w') as file: + file.write(str(secret_key)) + return secret_key