Lets see if this works
All checks were successful
Build (artifact) / build (push) Successful in 1m13s

This commit is contained in:
2026-06-29 07:57:03 -04:00
parent 6aacbfbb71
commit c01195643a
13 changed files with 112 additions and 54 deletions

View File

@@ -143,7 +143,7 @@ func NewACMEManager(config *common.AppConfig) (*ACMEManager, error) {
return nil, fmt.Errorf("cloudflare dns provider: %w", err)
}
if err := client.Challenge.SetDNS01Provider(cfProvider); err != nil {
if err = client.Challenge.SetDNS01Provider(cfProvider); err != nil {
return nil, fmt.Errorf("set dns-01 provider: %w", err)
}
@@ -159,7 +159,7 @@ func NewACMEManager(config *common.AppConfig) (*ACMEManager, error) {
return nil, fmt.Errorf("acme registration: %w", err)
}
mgr.User.Registration = reg
if err := saveACMEUser(mgr.accountRoot, mgr.User); err != nil {
if err = saveACMEUser(mgr.accountRoot, mgr.User); err != nil {
return nil, fmt.Errorf("save acme User registration: %w", err)
}
}
@@ -270,6 +270,7 @@ func buildDomainRuntimeConfig(config *common.AppConfig, domainConfig *common.Dom
// If a subdomain entry looks like a full FQDN already, it is used as-is.
func buildDomainList(baseDomain string, subs []string) []string {
seen := map[string]struct{}{}
out := make([]string, 0, len(subs)+1)
add := func(d string) {
d = strings.TrimSpace(strings.ToLower(d))
if d == "" {
@@ -279,6 +280,7 @@ func buildDomainList(baseDomain string, subs []string) []string {
return
}
seen[d] = struct{}{}
out = append(out, d)
}
add(baseDomain)
@@ -310,10 +312,6 @@ func buildDomainList(baseDomain string, subs []string) []string {
add(s + "." + baseDomain)
}
out := make([]string, 0, len(seen))
for d := range seen {
out = append(out, d)
}
return out
}

View File

@@ -0,0 +1,15 @@
package server
import (
"fmt"
"slices"
"testing"
)
func TestBuildDomainList(t *testing.T) {
domains := buildDomainList("example.com", []string{"*", "dev"})
fmt.Printf("domains: %v\n", domains)
if slices.Compare(domains, []string{"example.com", "*.example.com", "dev.example.com"}) != 0 {
t.Errorf("domains not equal")
}
}

View File

@@ -14,9 +14,7 @@ import (
"github.com/go-git/go-git/v5/plumbing/transport/http"
)
type GitWorkspace common.GitWorkspace
func (ws *GitWorkspace) AddAndPushCerts(dataRoot, repoSuffix string, config *common.AppConfig) error {
func AddAndPushCerts(ws *common.GitWorkspace, dataRoot, repoSuffix string, config *common.AppConfig) error {
certFiles, err := os.ReadDir(dataRoot)
if err != nil {
fmt.Printf("Error reading from directory: %v\n", err)