bug fixed /addplayer
This commit is contained in:
parent
3e61fa33c4
commit
1d485fc100
3 changed files with 93 additions and 32 deletions
|
|
@ -14,7 +14,21 @@ LICHESS_API_BASE_URL = "https://lichess.org/api"
|
|||
LICHESS_STATS_API_BASE_URL = "http://localhost:8001" # For Docker container access
|
||||
|
||||
# Database Configuration
|
||||
DATABASE_PATH = "/app/data/lichess_bot.db"
|
||||
def _resolve_database_path() -> str:
|
||||
# 1) Explicit env var has highest priority
|
||||
db_from_env = os.getenv("DATABASE_PATH")
|
||||
if db_from_env:
|
||||
return db_from_env
|
||||
# 2) Docker default if volume is mounted
|
||||
docker_data_dir = "/app/data"
|
||||
if os.path.isdir(docker_data_dir):
|
||||
return os.path.join(docker_data_dir, "lichess_bot.db")
|
||||
# 3) Local development fallback (repo data dir)
|
||||
repo_data_dir = os.path.join(os.path.dirname(__file__), "data")
|
||||
os.makedirs(repo_data_dir, exist_ok=True)
|
||||
return os.path.join(repo_data_dir, "lichess_bot.db")
|
||||
|
||||
DATABASE_PATH = _resolve_database_path()
|
||||
|
||||
# Period options for /setperiod command
|
||||
PERIOD_OPTIONS = [0, 15, 30, 60, 120, 180] # minutes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue