[CI-SKIP] Store Pre-Claude Code
All checks were successful
Build (artifact) / build (push) Has been skipped

This commit is contained in:
2026-04-22 22:26:21 -04:00
parent 727de333b4
commit 6aacbfbb71
30 changed files with 239 additions and 246 deletions

View File

@@ -1,4 +1,4 @@
package client
package main
import (
"fmt"
@@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"
appShared "git.nevets.tech/Steven/certman/app/shared"
"git.nevets.tech/Steven/certman/app"
"git.nevets.tech/Steven/certman/client"
"git.nevets.tech/Steven/certman/common"
"github.com/go-git/go-billy/v5/memfs"
@@ -18,7 +18,7 @@ type Daemon struct{}
func (d *Daemon) Init() {
fmt.Println("Starting CertManager in client mode...")
err := appShared.LoadDomainConfigs()
err := app.LoadDomainConfigs()
if err != nil {
log.Fatalf("Error loading domain configs: %v", err)
}
@@ -30,8 +30,8 @@ func (d *Daemon) Tick() {
fmt.Println("tick!")
// Get local copy of configs
config := appShared.Config()
localDomainConfigs := appShared.DomainStore().Snapshot()
config := app.Config()
localDomainConfigs := app.DomainStore().Snapshot()
// Loop over all domain configs (domains)
for domainStr, domainConfig := range localDomainConfigs {
@@ -44,17 +44,12 @@ func (d *Daemon) Tick() {
// If the repo doesn't exist, we can't check for a remote commit, so stop the rest of the check
repoExists := domainConfig.Internal.RepoExists
if repoExists {
var dataRoot string
if domainConfig.Certificates.DataRoot == "" {
config.Certificates.DataRoot = domainStr
} else {
dataRoot = domainConfig.Certificates.DataRoot
}
dataRoot := common.EffectiveDataRoot(config, domainConfig)
localHash, err := client.LocalCommitHash(domainStr, dataRoot)
if err != nil {
fmt.Printf("No local commit hash found for domain %s\n", domainStr)
}
gitSource, err := common.StrToGitSource(appShared.Config().Git.Host)
gitSource, err := common.StrToGitSource(app.Config().Git.Host)
if err != nil {
fmt.Printf("Error getting git source for domain %s: %v\n", domainStr, err)
continue
@@ -77,14 +72,15 @@ func (d *Daemon) Tick() {
}
// Ex: https://git.example.com/Org/Repo-suffix.git
// Clones repo and stores in gitWorkspace, skip if clone fails (doesn't exist?)
repoUrl := appShared.Config().Git.Server + "/" + config.Git.OrgName + "/" + domainStr + domainConfig.Repo.RepoSuffix + ".git"
repoUrl := app.Config().Git.Server + "/" + config.Git.OrgName + "/" + domainStr + domainConfig.Repo.RepoSuffix + ".git"
err := common.CloneRepo(repoUrl, gitWorkspace, common.Client, config)
if err != nil {
fmt.Printf("Error cloning domain repo %s: %v\n", domainStr, err)
continue
}
certsDir := appShared.DomainCertsDirWConf(domainStr, domainConfig)
effectiveDataRoot := common.EffectiveDataRoot(config, domainConfig)
certsDir := filepath.Join(effectiveDataRoot, "certificates", domainStr)
// Get files in repo
fileInfos, err := gitWorkspace.FS.ReadDir("/")
@@ -156,7 +152,7 @@ func (d *Daemon) Tick() {
func (d *Daemon) Reload() {
fmt.Println("Reloading configs...")
err := appShared.LoadDomainConfigs()
err := app.LoadDomainConfigs()
if err != nil {
fmt.Printf("Error loading domain configs: %v\n", err)
return