Add automatic configuration of Gitea credential helpers for go-gitea.mywire.org and 192.168.88.97:3000, and enhance --checks to show detailed status for these servers

This commit is contained in:
kdusek
2025-11-13 17:36:14 +01:00
parent 445d8050a6
commit 6c4892e961

View File

@@ -395,22 +395,53 @@ configure_git_presets() {
presets_needed+=("git config --global credential.https://bitbucket.org.helper manager")
fi
# Check Gitea configuration (if any Gitea URL is configured)
local gitea_urls=0
gitea_urls=$(git config --global --get-regexp "credential.*gitea.*helper" 2>/dev/null | wc -l) || gitea_urls=0
if [[ $gitea_urls -gt 0 ]]; then
print_success "✓ Gitea credential helpers configured ($gitea_urls found)"
presets_configured=$((presets_configured + 1))
# Check specific Gitea configurations
local gitea_configured=0
local gitea_needed=()
# Check go-gitea.mywire.org
local gitea1_helper=""
gitea1_helper=$(git config --global --get credential.https://go-gitea.mywire.org.helper 2>/dev/null) || gitea1_helper=""
if [[ "$gitea1_helper" == "manager" ]]; then
print_success "✓ Gitea (go-gitea.mywire.org) credential helper configured"
gitea_configured=$((gitea_configured + 1))
else
print_warning "✗ No Gitea credential helpers configured"
presets_needed+=("# For Gitea servers, configure domain-specific helper:")
presets_needed+=("git config --global credential.https://go-gitea.mywire.org.helper manager")
print_warning "✗ Gitea (go-gitea.mywire.org) credential helper not configured"
gitea_needed+=("git config --global credential.https://go-gitea.mywire.org.helper manager")
fi
# Check 192.168.88.97:3000
local gitea2_helper=""
gitea2_helper=$(git config --global --get credential.https://192.168.88.97:3000.helper 2>/dev/null) || gitea2_helper=""
if [[ "$gitea2_helper" == "manager" ]]; then
print_success "✓ Gitea (192.168.88.97:3000) credential helper configured"
gitea_configured=$((gitea_configured + 1))
else
print_warning "✗ Gitea (192.168.88.97:3000) credential helper not configured"
gitea_needed+=("git config --global credential.https://192.168.88.97:3000.helper manager")
fi
# Check for other Gitea configurations
local other_gitea_urls=0
other_gitea_urls=$(git config --global --get-regexp "credential.*gitea.*helper" 2>/dev/null | grep -v "go-gitea.mywire.org\|192.168.88.97:3000" | wc -l) || other_gitea_urls=0
if [[ $other_gitea_urls -gt 0 ]]; then
print_success "✓ Additional Gitea credential helpers configured ($other_gitea_urls found)"
fi
if [[ $gitea_configured -eq 2 ]]; then
presets_configured=$((presets_configured + 1))
fi
# Add needed Gitea configs to presets_needed
if [[ ${#gitea_needed[@]} -gt 0 ]]; then
presets_needed+=("# Configure Gitea credential helpers:")
presets_needed+=("${gitea_needed[@]}")
fi
# Summary
echo
print_status "Git Credential Manager Configuration Summary:"
print_status "Presets configured: $presets_configured/6"
print_status "Presets configured: $presets_configured/7"
if [[ ${#presets_needed[@]} -eq 0 ]]; then
print_success "All recommended presets are configured!"