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

View File

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