Revert to python config update

This commit is contained in:
Codex
2025-11-12 12:03:46 -06:00
parent 1f3505f132
commit 21a9ac6c86
2 changed files with 15 additions and 13 deletions

View File

@@ -5,7 +5,7 @@
"description": "Next-gen knowledge base that blends docs, whiteboards, and databases for self-hosted teams.",
"website": "https://affine.pro",
"contactEmail": "support@affine.pro",
"version": "0.1.14",
"version": "0.1.15",
"changelog": "Initial Cloudron packaging",
"manifestVersion": 2,
"minBoxVersion": "7.0.0",

View File

@@ -127,18 +127,20 @@ PY
record_env_var REDIS_SERVER_USERNAME "$username"
record_env_var REDIS_URL "$CLOUDRON_REDIS_URL"
record_env_var REDIS_SERVER_URL "$CLOUDRON_REDIS_URL"
jq --arg host "$host" \
--arg port "$port" \
--arg password "$password" \
--arg username "$username" \
--arg db "$db" \
'.redis.host = $host
| .redis.port = ($port|tonumber)
| .redis.password = $password
| .redis.username = $username
| .redis.db = ($db|tonumber)' \
"$APP_DATA_DIR/config/config.json" > "$APP_DATA_DIR/config/config.json.tmp"
mv "$APP_DATA_DIR/config/config.json.tmp" "$APP_DATA_DIR/config/config.json"
python3 - <<'PY'
import json
import os
from pathlib import Path
config_path = Path(os.environ['APP_DATA_DIR']) / 'config' / 'config.json'
data = json.loads(config_path.read_text())
redis = data.setdefault('redis', {})
redis['host'] = os.environ.get('REDIS_SERVER_HOST', '')
redis['port'] = int(os.environ.get('REDIS_SERVER_PORT') or 6379)
redis['password'] = os.environ.get('REDIS_SERVER_PASSWORD', '')
redis['username'] = os.environ.get('REDIS_SERVER_USERNAME', '')
redis['db'] = int(os.environ.get('REDIS_SERVER_DATABASE') or 0)
config_path.write_text(json.dumps(data, indent=2))
PY
log "Configured Redis endpoint"
}