Guard redis config defaults
This commit is contained in:
@@ -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.10",
|
"version": "0.1.11",
|
||||||
"changelog": "Initial Cloudron packaging",
|
"changelog": "Initial Cloudron packaging",
|
||||||
"manifestVersion": 2,
|
"manifestVersion": 2,
|
||||||
"minBoxVersion": "7.0.0",
|
"minBoxVersion": "7.0.0",
|
||||||
|
|||||||
10
start.sh
10
start.sh
@@ -108,11 +108,11 @@ from pathlib import Path
|
|||||||
config_path = Path(os.environ['APP_DATA_DIR']) / 'config' / 'config.json'
|
config_path = Path(os.environ['APP_DATA_DIR']) / 'config' / 'config.json'
|
||||||
data = json.loads(config_path.read_text())
|
data = json.loads(config_path.read_text())
|
||||||
redis = data.setdefault('redis', {})
|
redis = data.setdefault('redis', {})
|
||||||
redis['host'] = os.environ['REDIS_SERVER_HOST']
|
redis['host'] = os.environ.get('REDIS_SERVER_HOST', '')
|
||||||
redis['port'] = int(os.environ['REDIS_SERVER_PORT'])
|
redis['port'] = int(os.environ.get('REDIS_SERVER_PORT') or 6379)
|
||||||
redis['password'] = os.environ['REDIS_SERVER_PASSWORD']
|
redis['password'] = os.environ.get('REDIS_SERVER_PASSWORD', '')
|
||||||
redis['username'] = os.environ['REDIS_SERVER_USERNAME']
|
redis['username'] = os.environ.get('REDIS_SERVER_USERNAME', '')
|
||||||
redis['db'] = int(os.environ['REDIS_SERVER_DATABASE'])
|
redis['db'] = int(os.environ.get('REDIS_SERVER_DATABASE') or 0)
|
||||||
config_path.write_text(json.dumps(data, indent=2))
|
config_path.write_text(json.dumps(data, indent=2))
|
||||||
PY
|
PY
|
||||||
log "Configured Redis endpoint"
|
log "Configured Redis endpoint"
|
||||||
|
|||||||
Reference in New Issue
Block a user