Major refactoring
This commit is contained in:
@@ -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'
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user