summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2023-03-23 00:27:54 -0400
committerGalen Guyer <galen@galenguyer.com>2023-03-23 00:27:54 -0400
commit2865913a32a4bc6eb14b2471cece852225b0d945 (patch)
tree60f752e3845156ec554a4ad073aadb3a48496829
parent2be55dae00ed26634f1eef4ccd7aae83c44df212 (diff)
base58 tokens
-rw-r--r--config.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/config.py b/config.py
index 9475d5e..2ad6104 100644
--- a/config.py
+++ b/config.py
@@ -7,14 +7,14 @@ basedir = os.path.abspath(os.path.dirname(__file__))
dotenv_path = join(dirname(__file__), ".env")
load_dotenv(dotenv_path)
+def token(length: int = 32) -> str:
+ return ''.join(secrets.choice('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz') for _ in range(length))
class Config(object):
IP = os.environ.get("DYSPHORIA_IP") or "0.0.0.0"
PORT = os.environ.get("DYSPHORIA_PORT") or 5000
- SECRET_KEY = os.environ.get("DYSPHORIA_SECRET_KEY") or "".join(
- secrets.token_hex(16)
- )
- API_TOKEN = os.environ.get("DYSPHORIA_API_TOKEN") or "".join(secrets.token_hex(16))
+ SECRET_KEY = os.environ.get("DYSPHORIA_SECRET_KEY") or token()
+ API_TOKEN = os.environ.get("DYSPHORIA_API_TOKEN") or token()
WHISPER_MODEL_PATH = (
os.environ.get("DYSPHORIA_WHISPER_MODEL_PATH") or "models/whisper-large-v2-ct2/"
)