/
woodpecker86
/
cosmic-python-code
Обзор
Документация
Войти
/
woodpecker86
/
cosmic-python-code
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/allocation/config.py
28 строк
885 B
Harry
switch to a notifications class [notifications_class]
01 мар 2024, 18:05
01 мар 2024, 18:05
d6141c7
Код
Авторство
О чём код?
import os def get_postgres_uri(): host = os.environ.get("DB_HOST", "localhost") port = 54321 if host == "localhost" else 5432 password = os.environ.get("DB_PASSWORD", "abc123") user, db_name = "allocation", "allocation" return f"postgresql://{user}:{password}@{host}:{port}/{db_name}" def get_api_url(): host = os.environ.get("API_HOST", "localhost") port = 5005 if host == "localhost" else 80 return f"http://{host}:{port}" def get_redis_host_and_port(): host = os.environ.get("REDIS_HOST", "localhost") port = 63791 if host == "localhost" else 6379 return dict(host=host, port=port) def get_email_host_and_port(): host = os.environ.get("EMAIL_HOST", "localhost") port = 11025 if host == "localhost" else 1025 http_port = 18025 if host == "localhost" else 8025 return dict(host=host, port=port, http_port=http_port)