fix(streamlit): Fix emancipate to use app name not instance name
The emancipate function was checking for app folder existence using instance name (e.g., "pix") instead of the actual app name (e.g., "bazi_calculator"). Now properly resolves app from UCI config. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
004fc32725
commit
36e61cead8
@ -1489,17 +1489,30 @@ cmd_emancipate() {
|
|||||||
local name="$1"
|
local name="$1"
|
||||||
local domain="$2"
|
local domain="$2"
|
||||||
|
|
||||||
[ -z "$name" ] && { log_error "App name required"; usage; return 1; }
|
[ -z "$name" ] && { log_error "Instance name required"; usage; return 1; }
|
||||||
|
|
||||||
# Check if app exists
|
# Get instance port and app name from UCI
|
||||||
if [ ! -d "$APPS_PATH/$name" ] && [ ! -f "$APPS_PATH/${name}.py" ]; then
|
local port=$(uci -q get ${CONFIG}.${name}.port)
|
||||||
log_error "App '$name' not found"
|
local app=$(uci -q get ${CONFIG}.${name}.app)
|
||||||
log_error "Create first: streamlitctl app create $name"
|
|
||||||
return 1
|
# If no port, this might be an app name not instance name
|
||||||
|
if [ -z "$port" ]; then
|
||||||
|
# Try to find an instance for this app
|
||||||
|
local found_inst=$(uci show ${CONFIG} 2>/dev/null | grep "\.app='$name'" | head -1 | cut -d'.' -f2)
|
||||||
|
if [ -n "$found_inst" ]; then
|
||||||
|
port=$(uci -q get ${CONFIG}.${found_inst}.port)
|
||||||
|
app="$name"
|
||||||
|
name="$found_inst"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get instance port from UCI
|
# Check if app folder exists (use app name, not instance name)
|
||||||
local port=$(uci -q get ${CONFIG}.${name}.port)
|
local app_to_check="${app:-$name}"
|
||||||
|
if [ ! -d "$APPS_PATH/$app_to_check" ] && [ ! -f "$APPS_PATH/${app_to_check}.py" ]; then
|
||||||
|
log_error "App '$app_to_check' not found in $APPS_PATH"
|
||||||
|
log_error "Create first: streamlitctl app create $app_to_check"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
if [ -z "$port" ]; then
|
if [ -z "$port" ]; then
|
||||||
log_error "No instance configured for app '$name'"
|
log_error "No instance configured for app '$name'"
|
||||||
log_error "Add instance first: streamlitctl instance add $name <port>"
|
log_error "Add instance first: streamlitctl instance add $name <port>"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user