Spaces:
Sleeping
Sleeping
Download scripts/init_dev.py from gui-sparim/base_conhecimento: direct link, hf CLI and curl.
- Browser
- Download file 967 Bytes
-
https://huggingface.co/spaces/gui-sparim/base_conhecimento/resolve/main/scripts/init_dev.py
- Command line
-
hf download hf://spaces/gui-sparim/base_conhecimento/scripts/init_dev.py
-
curl -L -o init_dev.py https://huggingface.co/spaces/gui-sparim/base_conhecimento/resolve/main/scripts/init_dev.py
967 Bytes
| """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.") | |