HA add-on: use /config as persistent HOME (fix auth store path)
This commit is contained in:
+15
-9
@@ -30,14 +30,20 @@ export TZ="$TZNAME"
|
|||||||
# Reduce risk of secrets ending up in logs
|
# Reduce risk of secrets ending up in logs
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
# Persist everything under /data
|
# HA add-ons mount persistent storage at /config (maps to /addon_configs/<slug> on the host).
|
||||||
export HOME=/data
|
# Use /config as HOME so Clawdbot finds its auth store and config there.
|
||||||
mkdir -p /data/.clawdbot /data/clawd /data/keys /data/secrets
|
export HOME=/config
|
||||||
|
mkdir -p /config/.clawdbot /config/clawd /config/keys /config/secrets
|
||||||
|
|
||||||
|
# Back-compat: some docs/scripts assume /data; point it at /config.
|
||||||
|
if [ ! -e /data ]; then
|
||||||
|
ln -s /config /data || true
|
||||||
|
fi
|
||||||
|
|
||||||
# Store HA token (optional) in a local file for later use by the HA skill/tooling.
|
# Store HA token (optional) in a local file for later use by the HA skill/tooling.
|
||||||
if [ -n "$HA_TOKEN" ]; then
|
if [ -n "$HA_TOKEN" ]; then
|
||||||
umask 077
|
umask 077
|
||||||
printf '%s' "$HA_TOKEN" > /data/secrets/homeassistant.token
|
printf '%s' "$HA_TOKEN" > /config/secrets/homeassistant.token
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Decide Telegram DM access policy.
|
# Decide Telegram DM access policy.
|
||||||
@@ -63,7 +69,7 @@ if [ -z "$GW_TOKEN" ]; then
|
|||||||
GW_AUTH_BLOCK="auth: { mode: \"token\" }"
|
GW_AUTH_BLOCK="auth: { mode: \"token\" }"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat > /data/.clawdbot/clawdbot.json <<EOF
|
cat > /config/.clawdbot/clawdbot.json <<EOF
|
||||||
{
|
{
|
||||||
gateway: {
|
gateway: {
|
||||||
mode: "local",
|
mode: "local",
|
||||||
@@ -74,7 +80,7 @@ cat > /data/.clawdbot/clawdbot.json <<EOF
|
|||||||
},
|
},
|
||||||
agents: {
|
agents: {
|
||||||
defaults: {
|
defaults: {
|
||||||
workspace: "/data/clawd",
|
workspace: "/config/clawd",
|
||||||
model: { primary: "${MODEL_PRIMARY}" },
|
model: { primary: "${MODEL_PRIMARY}" },
|
||||||
models: {
|
models: {
|
||||||
"${MODEL_PRIMARY}": {}
|
"${MODEL_PRIMARY}": {}
|
||||||
@@ -103,7 +109,7 @@ echo "Telegram allowFrom JSON: ${ALLOW_FROM_JSON:-<none>}"
|
|||||||
|
|
||||||
# Connectivity sanity checks (do NOT print the token)
|
# Connectivity sanity checks (do NOT print the token)
|
||||||
# Auth store debug (redacted): never print tokens
|
# Auth store debug (redacted): never print tokens
|
||||||
AUTH_STORE="/data/.clawdbot/agents/main/agent/auth-profiles.json"
|
AUTH_STORE="/config/.clawdbot/agents/main/agent/auth-profiles.json"
|
||||||
if [ -f "$AUTH_STORE" ]; then
|
if [ -f "$AUTH_STORE" ]; then
|
||||||
echo "Auth store present at $AUTH_STORE"
|
echo "Auth store present at $AUTH_STORE"
|
||||||
echo "Auth store summary (redacted):"
|
echo "Auth store summary (redacted):"
|
||||||
@@ -130,8 +136,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Convenience info for later (MikroTik access path & HA token file)
|
# Convenience info for later (MikroTik access path & HA token file)
|
||||||
cat > /data/CONNECTION_NOTES.txt <<EOF
|
cat > /config/CONNECTION_NOTES.txt <<EOF
|
||||||
Home Assistant token (if set): /data/secrets/homeassistant.token
|
Home Assistant token (if set): /config/secrets/homeassistant.token
|
||||||
MikroTik SSH:
|
MikroTik SSH:
|
||||||
host=${MT_HOST}
|
host=${MT_HOST}
|
||||||
user=${MT_USER}
|
user=${MT_USER}
|
||||||
|
|||||||
Reference in New Issue
Block a user