Fix: Load Home Assistant UI config manually - v1.2.3
This commit is contained in:
parent
1b81ddc678
commit
04d5af4ea9
2 changed files with 18 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
name: "Newt Add-on"
|
name: "Newt Add-on"
|
||||||
version: "1.2.2"
|
version: "1.2.3"
|
||||||
slug: "newt"
|
slug: "newt"
|
||||||
description: "Runs Newt inside Home Assistant OS"
|
description: "Runs Newt inside Home Assistant OS"
|
||||||
arch:
|
arch:
|
||||||
|
@ -15,17 +15,16 @@ privileged:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
- DAC_READ_SEARCH
|
- DAC_READ_SEARCH
|
||||||
options:
|
options:
|
||||||
PANGOLIN_ENDPOINT: "https://yourendpoint.com"
|
PANGOLIN_ENDPOINT: "https://example.com"
|
||||||
NEWT_ID: "your_newt_id"
|
NEWT_ID: "your_newt_id"
|
||||||
NEWT_SECRET: "your_newt_secret"
|
NEWT_SECRET: "your_newt_secret"
|
||||||
schema:
|
schema:
|
||||||
PANGOLIN_ENDPOINT: "str"
|
PANGOLIN_ENDPOINT: "str"
|
||||||
NEWT_ID: "str"
|
NEWT_ID: "str"
|
||||||
NEWT_SECRET: "str"
|
NEWT_SECRET: "str"
|
||||||
environment:
|
# Ensure that environment variables are set correctly
|
||||||
PANGOLIN_ENDPOINT: "{options[PANGOLIN_ENDPOINT]}"
|
map:
|
||||||
NEWT_ID: "{options[NEWT_ID]}"
|
- config:rw
|
||||||
NEWT_SECRET: "{options[NEWT_SECRET]}"
|
|
||||||
hassio_api: true
|
hassio_api: true
|
||||||
homeassistant_api: true
|
homeassistant_api: true
|
||||||
auth_api: true
|
auth_api: true
|
||||||
|
|
18
newt/run.sh
18
newt/run.sh
|
@ -3,13 +3,21 @@ set -e # Stop the script on errors
|
||||||
|
|
||||||
echo "🔹 Starting Newt inside Home Assistant OS..."
|
echo "🔹 Starting Newt inside Home Assistant OS..."
|
||||||
|
|
||||||
# Load configuration from environment variables set by Home Assistant
|
# Load configuration manually from the add-on options JSON file
|
||||||
export PANGOLIN_ENDPOINT=${PANGOLIN_ENDPOINT}
|
CONFIG_PATH="/data/options.json"
|
||||||
export NEWT_ID=${NEWT_ID}
|
|
||||||
export NEWT_SECRET=${NEWT_SECRET}
|
if [[ ! -f "$CONFIG_PATH" ]]; then
|
||||||
|
echo "❌ ERROR: Configuration file not found at $CONFIG_PATH!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract values from the JSON config
|
||||||
|
PANGOLIN_ENDPOINT=$(jq -r '.PANGOLIN_ENDPOINT' "$CONFIG_PATH")
|
||||||
|
NEWT_ID=$(jq -r '.NEWT_ID' "$CONFIG_PATH")
|
||||||
|
NEWT_SECRET=$(jq -r '.NEWT_SECRET' "$CONFIG_PATH")
|
||||||
|
|
||||||
# Validate if configuration values are provided
|
# Validate if configuration values are provided
|
||||||
if [[ -z "$PANGOLIN_ENDPOINT" || -z "$NEWT_ID" || -z "$NEWT_SECRET" ]]; then
|
if [[ -z "$PANGOLIN_ENDPOINT" || -z "$NEWT_ID" || -z "$NEWT_SECRET" || "$PANGOLIN_ENDPOINT" == "null" ]]; then
|
||||||
echo "❌ ERROR: Missing required configuration values!"
|
echo "❌ ERROR: Missing required configuration values!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue