Fix: Use Supervisor API instead of docker CLI - v1.1.6
This commit is contained in:
parent
cc1cab7088
commit
34ba54aa97
2 changed files with 19 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
name: "Newt Add-on"
|
name: "Newt Add-on"
|
||||||
version: "1.1.5"
|
version: "1.1.6"
|
||||||
slug: "newt"
|
slug: "newt"
|
||||||
description: "Runs the Newt container inside Home Assistant using Supervisor API"
|
description: "Runs the Newt container inside Home Assistant using Supervisor API"
|
||||||
arch:
|
arch:
|
||||||
|
|
28
newt/run.sh
28
newt/run.sh
|
@ -6,9 +6,9 @@ set -e # Stop script on errors
|
||||||
echo "🔹 Starting Newt container using Home Assistant Supervisor API..."
|
echo "🔹 Starting Newt container using Home Assistant Supervisor API..."
|
||||||
|
|
||||||
# Load config from Home Assistant options
|
# Load config from Home Assistant options
|
||||||
PANGOLIN_ENDPOINT=${PANGOLIN_ENDPOINT:-"https://dash.opland.net"}
|
PANGOLIN_ENDPOINT=${PANGOLIN_ENDPOINT:-"https://eample.com"}
|
||||||
NEWT_ID=${NEWT_ID:-"ru32vsg8ls5lx93"}
|
NEWT_ID=${NEWT_ID:-"123456789"}
|
||||||
NEWT_SECRET=${NEWT_SECRET:-"5rbqgpc292989uk9kz52hmypoyz6u9jf7k670fqja8p4un8o"}
|
NEWT_SECRET=${NEWT_SECRET:-"waytolongsecret"}
|
||||||
|
|
||||||
|
|
||||||
if [[ -z "$PANGOLIN_ENDPOINT" || -z "$NEWT_ID" || -z "$NEWT_SECRET" ]]; then
|
if [[ -z "$PANGOLIN_ENDPOINT" || -z "$NEWT_ID" || -z "$NEWT_SECRET" ]]; then
|
||||||
|
@ -21,13 +21,21 @@ echo " PANGOLIN_ENDPOINT=$PANGOLIN_ENDPOINT"
|
||||||
echo " NEWT_ID=$NEWT_ID"
|
echo " NEWT_ID=$NEWT_ID"
|
||||||
echo " NEWT_SECRET=$NEWT_SECRET"
|
echo " NEWT_SECRET=$NEWT_SECRET"
|
||||||
|
|
||||||
# Run Newt container
|
# Use Home Assistant Supervisor API to run the Newt container
|
||||||
docker run -d --restart unless-stopped \
|
echo "🔹 Creating and starting Newt container via Supervisor API..."
|
||||||
--name newt \
|
curl --silent --fail --header "Authorization: Bearer ${SUPERVISOR_TOKEN}" \
|
||||||
-e PANGOLIN_ENDPOINT="$PANGOLIN_ENDPOINT" \
|
-X POST "http://supervisor/docker/containers/run" \
|
||||||
-e NEWT_ID="$NEWT_ID" \
|
-H "Content-Type: application/json" \
|
||||||
-e NEWT_SECRET="$NEWT_SECRET" \
|
-d '{
|
||||||
fosrl/newt
|
"name": "newt",
|
||||||
|
"image": "fosrl/newt",
|
||||||
|
"restart_policy": "unless-stopped",
|
||||||
|
"env": [
|
||||||
|
"PANGOLIN_ENDPOINT='"$PANGOLIN_ENDPOINT"'",
|
||||||
|
"NEWT_ID='"$NEWT_ID"'",
|
||||||
|
"NEWT_SECRET='"$NEWT_SECRET"'"
|
||||||
|
]
|
||||||
|
}' || { echo "❌ ERROR: Failed to start Newt container via Supervisor API"; exit 22; }
|
||||||
|
|
||||||
echo "✅ Newt container started successfully!"
|
echo "✅ Newt container started successfully!"
|
||||||
exec tail -f /dev/null
|
exec tail -f /dev/null
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue