security: remplace les chemins système hardcodés par des variables d'env
admin/builds.py : STATE_FILE, LOG_FILE, DEPLOY_SCRIPT lus depuis l'environnement dynamic/db.py : supprime le fallback de chemin système pour DATABASE admin/.env.example : documente les nouvelles variables STATE_FILE, LOG_FILE Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9328c852cc
commit
e50eec1785
3 changed files with 8 additions and 5 deletions
|
|
@ -7,5 +7,7 @@ ALPID_DISCOVERY_URL=https://alpid.alpinux.org/realms/alpinux/.well-known/openid-
|
|||
# Noms des groupes Keycloak autorisés (séparés par virgule)
|
||||
ADMIN_GROUPS=admins
|
||||
|
||||
# Chemin du script de déploiement (défaut dans builds.py si non défini)
|
||||
# Chemins de déploiement (valeurs par défaut dans /tmp — à définir en production)
|
||||
# DEPLOY_SCRIPT=<chemin absolu vers le script de déploiement>
|
||||
# STATE_FILE=<chemin absolu vers builds.json>
|
||||
# LOG_FILE=<chemin absolu vers current.log>
|
||||
|
|
|
|||
|
|
@ -3,15 +3,16 @@ Gestion des builds : exécution, état, historique.
|
|||
Un seul build peut tourner à la fois.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
STATE_FILE = Path("/var/lib/alpinux-admin/builds.json")
|
||||
LOG_FILE = Path("/var/lib/alpinux-admin/current.log")
|
||||
DEPLOY_SCRIPT = Path("/home/alpinux/site/scripts") / "deploy-wiki.sh"
|
||||
STATE_FILE = Path(os.environ.get("STATE_FILE", "/tmp/admin-state.json"))
|
||||
LOG_FILE = Path(os.environ.get("LOG_FILE", "/tmp/admin-build.log"))
|
||||
DEPLOY_SCRIPT = Path(os.environ.get("DEPLOY_SCRIPT", "deploy-wiki.sh"))
|
||||
|
||||
_lock = threading.Lock()
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from flask import g
|
|||
|
||||
def get_db():
|
||||
if 'db' not in g:
|
||||
db_path = os.environ.get('DATABASE', '/var/lib/dynamic-alpinux/scores.db')
|
||||
db_path = os.environ.get('DATABASE', 'scores.db')
|
||||
os.makedirs(os.path.dirname(db_path), exist_ok=True)
|
||||
g.db = sqlite3.connect(db_path)
|
||||
g.db.row_factory = sqlite3.Row
|
||||
|
|
|
|||
Loading…
Reference in a new issue