[CI-SKIP] Stash Claude Edits

This commit is contained in:
2026-05-06 20:10:11 -05:00
parent fb1abd6211
commit 8c6ab6dc83
3 changed files with 40 additions and 11 deletions

View File

@@ -79,7 +79,7 @@ func newKeyCmd(cmd *cobra.Command, args []string) {
if err != nil {
log.Fatalf("%v", err)
}
fmt.Printf(key)
fmt.Println(key)
}
func newDomainCmd(domain, domainDir string, dirOverridden bool) error {

View File

@@ -1,7 +1,36 @@
package main
import "fmt"
import (
"fmt"
"os"
"git.nevets.tech/Steven/certman/app"
"github.com/spf13/cobra"
)
func main() {
fmt.Println("Hello server")
rootCmd := &cobra.Command{
Use: "certman",
Short: "CertMan",
Long: "Certificate Manager",
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
}
rootCmd.AddCommand(app.VersionCmd)
rootCmd.AddCommand(app.NewKeyCmd)
rootCmd.AddCommand(app.DevCmd)
rootCmd.AddCommand(app.NewDomainCmd)
rootCmd.AddCommand(app.InstallCmd)
rootCmd.AddCommand(app.CertCmd)
rootCmd.AddCommand(app.DaemonCmd)
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}

View File

@@ -66,12 +66,12 @@ func VerifyOwnership(ws *common.GitWorkspace, uuid string) (bool, error) {
return false, fmt.Errorf("domain is owned by server %q", existing)
}
// AddAndPushCerts stages every *.crpt file from dataRoot into the workspace,
// AddAndPushCerts stages every *.crpt file from certsDir into the workspace,
// (re-)writes SERVER_ID with config.App.UUID, commits any resulting change,
// and pushes to origin/<pushBranch>. If nothing changed the call is a no-op
// and returns nil without pushing.
func AddAndPushCerts(ws *common.GitWorkspace, dataRoot string, config *common.AppConfig) error {
if err := stageCerts(ws, dataRoot); err != nil {
func AddAndPushCerts(ws *common.GitWorkspace, certsDir string, config *common.AppConfig) error {
if err := stageCerts(ws, certsDir); err != nil {
return err
}
if err := stageFile(ws, serverIDFile, []byte(config.App.UUID)); err != nil {
@@ -111,19 +111,19 @@ func AddAndPushCerts(ws *common.GitWorkspace, dataRoot string, config *common.Ap
return nil
}
// stageCerts copies every *.crpt file in dataRoot into the workspace
// stageCerts copies every *.crpt file in certsDir into the workspace
// filesystem and adds it to the work tree.
func stageCerts(ws *common.GitWorkspace, dataRoot string) error {
entries, err := os.ReadDir(dataRoot)
func stageCerts(ws *common.GitWorkspace, certsDir string) error {
entries, err := os.ReadDir(certsDir)
if err != nil {
return fmt.Errorf("read %s: %w", dataRoot, err)
return fmt.Errorf("read %s: %w", certsDir, err)
}
for _, entry := range entries {
name := entry.Name()
if !strings.HasSuffix(name, ".crpt") {
continue
}
body, err := os.ReadFile(filepath.Join(dataRoot, name))
body, err := os.ReadFile(filepath.Join(certsDir, name))
if err != nil {
return fmt.Errorf("read %s: %w", name, err)
}