chore: auto-bootstrap cli config

This commit is contained in:
Andreas Dueren
2025-11-05 05:58:50 -06:00
parent fc9abad56b
commit 8f3a34a277
2 changed files with 37 additions and 35 deletions

View File

@@ -602,16 +602,32 @@ CLI_DATA_DIR="$DATA_DIR/cli-data"
mkdir -p "$CLI_DATA_DIR"
chown cloudron:cloudron "$CLI_DATA_DIR"
chmod 700 "$CLI_DATA_DIR"
CLI_EXPORT_DIR="$CLI_DATA_DIR/export"
if [ ! -d "$CLI_EXPORT_DIR" ]; then
mkdir -p "$CLI_EXPORT_DIR"
chown cloudron:cloudron "$CLI_EXPORT_DIR"
chmod 700 "$CLI_EXPORT_DIR"
fi
CLI_HOME="$DATA_DIR/home/.ente"
mkdir -p "$CLI_HOME"
cat > "$CLI_HOME/config.yaml" <<EOF_CLI
CLI_DATA_CONFIG="$CLI_DATA_DIR/config.yaml"
if [ ! -f "$CLI_DATA_CONFIG" ]; then
cat > "$CLI_DATA_CONFIG" <<EOF_CLI_DATA
endpoint:
api: ${API_ORIGIN}
log:
http: false
EOF_CLI
chown -R cloudron:cloudron "$DATA_DIR/home"
EOF_CLI_DATA
chown cloudron:cloudron "$CLI_DATA_CONFIG"
chmod 600 "$CLI_DATA_CONFIG"
log INFO "Initialised CLI data configuration at $CLI_DATA_CONFIG"
fi
CLI_HOME="$DATA_DIR/home/.ente"
mkdir -p "$CLI_HOME"
if [ ! -f "$CLI_HOME/config.yaml" ]; then
ln -sf "$CLI_DATA_CONFIG" "$CLI_HOME/config.yaml"
fi
chown -R cloudron:cloudron "$DATA_DIR/home" "$CLI_HOME"
chmod 700 "$DATA_DIR/home"
log INFO "Rendering Caddy configuration"