summaryrefslogtreecommitdiff
path: root/config.py
blob: 2ad6104c56e32f6a3a44bf340801704358f4456c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import secrets
from os.path import join, dirname
from dotenv import load_dotenv

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 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/"
    )
    WHISPER_DEVICE = os.environ.get("DYSPHORIA_WHISPER_DEVICE") or "cpu"