Spaces:
Sleeping
Sleeping
| set -e | |
| DATA_DIR=/data | |
| JSON_FILE=/defaults/library.json | |
| mkdir -p "$DATA_DIR" | |
| chown -R 911:911 "$DATA_DIR" | |
| # Initialisation de la base si elle n’existe pas encore | |
| if [ ! -f "$DATA_DIR/index.sqlite3" ]; then | |
| echo "=== Initialisation d'ArchiveBox ===" | |
| gosu 911 archivebox init --setup | |
| fi | |
| # Ajout automatique des URLs définies dans library.json | |
| if [ -f "$JSON_FILE" ]; then | |
| echo "=== Ajout des URLs depuis library.json ===" | |
| python3 -c " | |
| import json, subprocess | |
| with open('$JSON_FILE') as f: | |
| data = json.load(f) | |
| for url in data.get('urls', []): | |
| print(f'Ajout de {url}...') | |
| subprocess.run(['gosu', '911', 'archivebox', 'add', url], check=False) | |
| " | |
| fi | |
| echo "=== Démarrage du serveur ArchiveBox sur le port 7860 ===" | |
| # Le port se passe sous la forme 0.0.0.0:7860, sans --port | |
| exec gosu 911 archivebox server --quick-init 0.0.0.0:7860 |