diff options
author | Galen Guyer <galen@galenguyer.com> | 2023-03-23 00:27:54 -0400 |
---|---|---|
committer | Galen Guyer <galen@galenguyer.com> | 2023-03-23 00:27:54 -0400 |
commit | 2865913a32a4bc6eb14b2471cece852225b0d945 (patch) | |
tree | 60f752e3845156ec554a4ad073aadb3a48496829 | |
parent | 2be55dae00ed26634f1eef4ccd7aae83c44df212 (diff) |
base58 tokens
-rw-r--r-- | config.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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/" ) |