Major refactoring

This commit is contained in:
2026-03-04 18:28:52 +01:00
parent 2cbab1a0a2
commit 45495f4b47
21 changed files with 885 additions and 15 deletions

View File

@@ -10,6 +10,7 @@ import (
"strings"
"sync"
pb "git.nevets.tech/Keys/CertManager/proto/v1"
"github.com/google/uuid"
"github.com/spf13/viper"
)
@@ -186,6 +187,18 @@ func SaveDomainConfigs() error {
return nil
}
// ---------------------------------------------------------------------------
// Domain Specific Lookups
// ---------------------------------------------------------------------------
func PostPullHooks(domain string) ([]*pb.Hook, error) {
var hooks []*pb.Hook
if err := viper.UnmarshalKey("Hooks.PostPull", hooks); err != nil {
return nil, err
}
return hooks, nil
}
// ---------------------------------------------------------------------------
// Effective lookups (domain → global fallback)
// ---------------------------------------------------------------------------
@@ -297,7 +310,7 @@ func CreateDomainConfig(domain string) error {
"{domain}", domain,
"{key}", key,
).Replace(defaultServerDomainConfig)
case "Client":
case "client":
content = strings.NewReplacer(
"{domain}", domain,
"{key}", key,
@@ -393,6 +406,12 @@ crypto_key = '{key}'
domain_name = '{domain}'
enabled = true
[Hooks.PostPull]
command = []
cwd = "/dev/null"
timeout_seconds = 30
env = { "FOO" = "bar" }
[Repo]
repo_suffix = '-certificates'
`