Add standalone approve-sensors script
Creates a wrapper that sets minimal env vars so the tool can run without full MQTT configuration.
This commit is contained in:
23
scripts/approve-sensors.sh
Executable file
23
scripts/approve-sensors.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
# Wrapper script for approve-sensors that sets minimal required env vars
|
||||
|
||||
# Get script directory
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
|
||||
|
||||
# Set minimal required environment variables
|
||||
export MQTT_HOST="${MQTT_HOST:-localhost}"
|
||||
export MQTT_PORT="${MQTT_PORT:-1883}"
|
||||
|
||||
# Load actual config if it exists (will override defaults)
|
||||
if [ -f "$PROJECT_ROOT/config/sensorpajen.env" ]; then
|
||||
set -a
|
||||
source "$PROJECT_ROOT/config/sensorpajen.env"
|
||||
set +a
|
||||
fi
|
||||
|
||||
# Activate virtual environment
|
||||
source "$PROJECT_ROOT/.venv/bin/activate"
|
||||
|
||||
# Run the approve-sensors command
|
||||
python -m sensorpajen.approve_sensors "$@"
|
||||
Reference in New Issue
Block a user