Compare commits
2 Commits
feature/tr
...
4b519610af
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b519610af | ||
| b58a0346d1 |
@@ -296,18 +296,28 @@ update_authelia_config() {
|
|||||||
existing_notifier="$existing_notifier" \
|
existing_notifier="$existing_notifier" \
|
||||||
yq e -i '.notifier = strenv(existing_notifier)' "$TEMP_CONFIG"
|
yq e -i '.notifier = strenv(existing_notifier)' "$TEMP_CONFIG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update domain settings from .env
|
# Update domain settings from .env
|
||||||
echo -e "${BLUE}Applying Tailscale domain settings...${NC}"
|
echo -e "${BLUE}Applying Tailscale domain settings...${NC}"
|
||||||
|
|
||||||
# Replace placeholder full hostname - using proper yq syntax instead of walk()
|
# Update domain in session section
|
||||||
yq e -i "(.. | select(tag == \"!!str\" and . == \"tailscale-nas.your-tailnet.ts.net\")) = \"${FULL_HOSTNAME}\"" "$TEMP_CONFIG"
|
yq e -i ".session.cookies[0].domain = \"${TAILNET_DOMAIN}\"" "$TEMP_CONFIG"
|
||||||
|
|
||||||
# Replace placeholder tailnet domain - using proper yq syntax instead of walk()
|
# Update domain in access_control (find wildcard domain rule and update it)
|
||||||
yq e -i "(.. | select(tag == \"!!str\" and . == \"your-tailnet.ts.net\")) = \"${TAILNET_DOMAIN}\"" "$TEMP_CONFIG"
|
# This assumes there's a rule with a wildcard domain like "*.example.com"
|
||||||
|
local domain_rule_index=$(yq e ".access_control.rules | map(.domain) | map(select(. == \"*.*\")) | indices" "$TEMP_CONFIG" | head -n 1 | tr -d '[]')
|
||||||
|
if [[ -n "$domain_rule_index" && "$domain_rule_index" != "null" ]]; then
|
||||||
|
yq e -i ".access_control.rules[$domain_rule_index].domain = \"${WILDCARD_DOMAIN}\"" "$TEMP_CONFIG"
|
||||||
|
fi
|
||||||
|
|
||||||
# Move temp file to final location
|
# Update authelia_url if it exists (it's a URL that must match cookie scope)
|
||||||
|
if yq e -e '.identity_validation.reset_password.authelia_url' "$TEMP_CONFIG" &>/dev/null; then
|
||||||
|
yq e -i ".identity_validation.reset_password.authelia_url = \"https://${FULL_HOSTNAME}\"" "$TEMP_CONFIG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Move the temp file to the final location
|
||||||
mv "$TEMP_CONFIG" "$AUTHELIA_CONFIG"
|
mv "$TEMP_CONFIG" "$AUTHELIA_CONFIG"
|
||||||
|
|
||||||
echo -e "${GREEN}Authelia configuration updated successfully!${NC}"
|
echo -e "${GREEN}Authelia configuration updated successfully!${NC}"
|
||||||
@@ -318,14 +328,15 @@ update_authelia_config() {
|
|||||||
# Create a new file from the example
|
# Create a new file from the example
|
||||||
cp "$AUTHELIA_CONFIG_EXAMPLE" "$AUTHELIA_CONFIG.new"
|
cp "$AUTHELIA_CONFIG_EXAMPLE" "$AUTHELIA_CONFIG.new"
|
||||||
|
|
||||||
# Replace placeholders manually
|
# Update domain settings with sed (more fragile)
|
||||||
sed -i "s|tailscale-nas\.your-tailnet\.ts\.net|${FULL_HOSTNAME}|g" "$AUTHELIA_CONFIG.new"
|
sed -i "s/domain: \".*\"/domain: \"${TAILNET_DOMAIN}\"/" "$AUTHELIA_CONFIG.new"
|
||||||
sed -i "s|your-tailnet\.ts\.net|${TAILNET_DOMAIN}|g" "$AUTHELIA_CONFIG.new"
|
sed -i "s/domain: \"\\*\\..*\"/domain: \"${WILDCARD_DOMAIN}\"/" "$AUTHELIA_CONFIG.new"
|
||||||
|
sed -i "s|authelia_url: \"https://.*\"|authelia_url: \"https://${FULL_HOSTNAME}\"|" "$AUTHELIA_CONFIG.new"
|
||||||
|
|
||||||
# Move the new file to the final location
|
# Move the new file to the final location
|
||||||
mv "$AUTHELIA_CONFIG.new" "$AUTHELIA_CONFIG"
|
mv "$AUTHELIA_CONFIG.new" "$AUTHELIA_CONFIG"
|
||||||
|
|
||||||
echo -e "${YELLOW}Authelia configuration updated with sed.${NC}"
|
echo -e "${YELLOW}Authelia configuration updated with sed. Secret values might need to be manually transferred.${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${GREEN}Authelia configuration update completed.${NC}"
|
echo -e "${GREEN}Authelia configuration update completed.${NC}"
|
||||||
@@ -333,6 +344,7 @@ update_authelia_config() {
|
|||||||
echo -e "${CYAN} docker compose restart authelia${NC}"
|
echo -e "${CYAN} docker compose restart authelia${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# PART 3: Update service configurations
|
# PART 3: Update service configurations
|
||||||
##################################################
|
##################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user