Spaces:
Sleeping
Sleeping
File size: 967 Bytes
75123b0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | """Generate local settings without committing passwords to the repository."""
import os
import secrets
from pathlib import Path
root = Path(__file__).resolve().parents[1]
env = root / ".env"
runtime = root / ".runtime"
runtime.mkdir(exist_ok=True)
if not env.exists():
password = secrets.token_urlsafe(18)
template = (root / ".env.example").read_text()
template = template.replace(
"BOOTSTRAP_ADMIN_PASSWORD=\n", f"BOOTSTRAP_ADMIN_PASSWORD={password}\n"
)
env.write_text(template)
env.chmod(0o600)
if "AUTH_PROVIDER=local" in template:
access = runtime / "dev-access.txt"
access.write_text(
f"CARLA — acesso inicial local\n\nPorta de entrada: carla\nUsuário: admin\nSenha temporária: {password}\n\nNo primeiro login, defina sua senha pessoal.\nA senha temporária só é usada ao criar o administrador no banco vazio.\n"
)
access.chmod(0o600)
print("Configuração local pronta.")
|