better secrets admin

This commit is contained in:
2026-07-19 09:58:27 +02:00
parent 768ccab09f
commit 0c03348c88
6 changed files with 118 additions and 75 deletions
+6 -3
View File
@@ -1,11 +1,14 @@
import pickle
from pathlib import Path
from cryptography.fernet import Fernet
from secrets_config import load_secrets
# =====================================================
# SECRET KEY (only your program has this)
# =====================================================
# Generate once using: Fernet.generate_key()
_SECRET_KEY = b'YFK7QCyTzhyLO4vqrnRxvDAI5uu8mXEYrInEjbRoQgs='
# The key is generated once and stored outside Git in instance/secrets.yaml.
_SECRET_KEY = load_secrets(Path(__file__).parent / "instance")["fernet"]["key"].encode("ascii")
fernet = Fernet(_SECRET_KEY)
@@ -56,4 +59,4 @@ print("Type Before :- ",type(bytes_data))
print(string_data)
print("Type After :- ",type(string_data))
print("Type After :- ",type(string_data))