resa-padel/resa_padel/config.py

27 lines
785 B
Python

import logging.config
import os
import pendulum
import yaml
from dotenv import load_dotenv
load_dotenv()
GESTION_SPORTS_URL = "https://toulousepadelclub.gestion-sports.com"
USER = os.environ.get("USER")
PASSWORD = os.environ.get("PASSWORD")
CLUB_ID = os.environ.get("CLUB_ID")
_court_ids = os.environ.get("COURT_IDS") or ""
COURT_IDS = [int(court_id) for court_id in _court_ids.split(",")] if _court_ids else []
SPORT_ID = int(os.environ.get("SPORT_ID"))
DATE_TIME = pendulum.parse(os.environ.get("DATE_TIME"))
def init_log_config():
root_dir = os.path.realpath(os.path.dirname(__file__))
logging_file = root_dir + "/logging.yaml"
with open(logging_file, "r") as f:
logging_config = yaml.safe_load(f.read())
logging.config.dictConfig(logging_config)