fix(missions): patch selector to bypass env checks for secure wrapper compatibility
This commit is contained in:
@@ -264,6 +264,38 @@ if [ -f "$WALDWAECHTER_LIB" ]; then
|
||||
print_info "Patched waldwaechter.sh guard."
|
||||
fi
|
||||
|
||||
# 9. Patch Mission Selector (Bypass Env Checks)
|
||||
# The selector expects a local .env and explicit API keys.
|
||||
# We are using a secure wrapper, so we need to tell the selector to trust the system.
|
||||
SELECTOR_SCRIPT="$HOME_DIR/missions/crumb-mission-selector.sh"
|
||||
if [ -f "$SELECTOR_SCRIPT" ]; then
|
||||
print_info "Patching crumb-mission-selector.sh to trust secure wrapper..."
|
||||
|
||||
# 1. Force AI_AVAILABLE=true even if .env load fails
|
||||
# Replace: if ! load_env; then
|
||||
# With: if true; then (effectively) or asking load_env to not be strict.
|
||||
# Better: Patch the fallback block.
|
||||
# Original:
|
||||
# if ! load_env; then
|
||||
# # Keine .env gefunden - das ist OK, AI Features sind dann deaktiviert
|
||||
# AI_AVAILABLE=false
|
||||
# else
|
||||
|
||||
# We replace 'AI_AVAILABLE=false' with 'AI_AVAILABLE=true # Wrapper Mode'
|
||||
sed -i 's/AI_AVAILABLE=false/AI_AVAILABLE=true # Secure Wrapper Mode/' "$SELECTOR_SCRIPT"
|
||||
|
||||
# 2. Bypass explicit Key Checks in menus
|
||||
# Checks look like: [[ -z "$OPENROUTER_API_KEY" ]]
|
||||
# We want them to pass. We can export a dummy key in the script or remove the checks.
|
||||
# Injecting a dummy key at the top is safest and easiest.
|
||||
# We insert it after the SHA-bang.
|
||||
sed -i '2i\
|
||||
# SECURE WRAPPER MODE: Dummy key to satisfy menu checks\
|
||||
export OPENROUTER_API_KEY="managed-by-wrapper"' "$SELECTOR_SCRIPT"
|
||||
|
||||
print_info "Patched mission selector for wrapper compatibility."
|
||||
fi
|
||||
|
||||
# 5. Create Systemd Service
|
||||
print_info "Creating systemd service..."
|
||||
cat << EOF > /etc/systemd/system/${SERVICE_NAME}
|
||||
|
||||
Reference in New Issue
Block a user