feat: Implement core Python FastAPI backend for user authentication, vault management, and file operations.
This commit is contained in:
@@ -31,14 +31,22 @@ def _read() -> dict:
|
||||
|
||||
def _write(data: dict):
|
||||
"""Atomic write: write to .tmp then rename to prevent corruption."""
|
||||
USERS_FILE.parent.mkdir(parents=True, exist_ok=True)
|
||||
tmp = USERS_FILE.with_suffix(".tmp")
|
||||
tmp.write_text(json.dumps(data, indent=2, default=str), encoding="utf-8")
|
||||
shutil.move(str(tmp), str(USERS_FILE))
|
||||
try:
|
||||
USERS_FILE.chmod(0o600)
|
||||
except OSError:
|
||||
pass # Windows doesn't support Unix permissions
|
||||
USERS_FILE.parent.mkdir(parents=True, exist_ok=True)
|
||||
tmp = USERS_FILE.with_suffix(".tmp")
|
||||
tmp.write_text(json.dumps(data, indent=2, default=str), encoding="utf-8")
|
||||
shutil.move(str(tmp), str(USERS_FILE))
|
||||
try:
|
||||
USERS_FILE.chmod(0o600)
|
||||
except OSError:
|
||||
pass # Windows doesn't support Unix permissions
|
||||
except PermissionError as e:
|
||||
logger.critical("=" * 60)
|
||||
logger.critical(f"ERREUR DE PERMISSION : Impossible d'écrire dans {USERS_FILE.parent}")
|
||||
logger.critical("Le conteneur n'a pas les droits sur le volume monté dans /app/data.")
|
||||
logger.critical("FIX : Exécutez sur l'hôte (Linux) : sudo chown -R 1000:1000 /votre/chemin/data")
|
||||
logger.critical("=" * 60)
|
||||
raise e
|
||||
|
||||
|
||||
def has_users() -> bool:
|
||||
|
||||
Reference in New Issue
Block a user