Refactored config system again
All checks were successful
Build (artifact) / build (push) Successful in 27s

This commit is contained in:
2026-06-30 16:48:05 -04:00
parent c01195643a
commit 0a78b70821
18 changed files with 478 additions and 175 deletions

View File

@@ -293,15 +293,15 @@ func MakeCredential(username, groupname string) (*syscall.Credential, error) {
return &syscall.Credential{Uid: uid, Gid: gid}, nil
}
func EffectiveDataRoot(config *AppConfig, domainConfig *DomainConfig) string {
// EffectiveDataRoot resolves the data root for a domain. The per-domain
// override takes precedence; otherwise the app-level data root is used; if
// both are empty, the current working directory is used.
func EffectiveDataRoot(config *AppConfig, domainDataRoot string) string {
if config == nil {
return ""
}
if domainConfig == nil {
return ""
}
if domainConfig.Certificates.DataRoot == "" {
if domainDataRoot == "" {
if config.Certificates.DataRoot == "" {
workDir, err := os.Getwd()
if err != nil {
@@ -311,7 +311,7 @@ func EffectiveDataRoot(config *AppConfig, domainConfig *DomainConfig) string {
}
return config.Certificates.DataRoot
}
return domainConfig.Certificates.DataRoot
return domainDataRoot
}
var fqdnRegex = regexp.MustCompile(`^(?i:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$`)