refactor(archie,system): remove runtime config writes and finish track 1 (#2153)

This commit is contained in:
sam committed 2026-11-28 11:33:13 +11:00
1 parent 3107a9fbe3
commit 56f1356d75
8 files changed
+45 -200

No files matched your search

+25 -6
View File
@@ -47,13 +47,9 @@ func run() error {
switch flag.Arg(0) {
case "":
case "migrate":
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
return archie.Migrate(ctx, *configPath)
return runMigrate(*configPath, flag.Args()[1:])
case "bootstrap":
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
return archie.Bootstrap(ctx, *configPath, *specPath)
return runBootstrap(*configPath, *specPath, flag.Args()[1:])
case "rekey":
return runRekey(*configPath, flag.Args()[1:])
case "bundle":
@@ -108,6 +104,29 @@ func runRekey(configPath string, args []string) error {
return archie.Rekey(ctx, configPath, rcfg)
}
func runMigrate(defaultConfig string, args []string) error {
fs := flag.NewFlagSet("migrate", flag.ContinueOnError)
configPath := fs.String("config", defaultConfig, "path to the bootstrap config file")
if err := fs.Parse(args); err != nil {
return err
}
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
return archie.Migrate(ctx, *configPath)
}
func runBootstrap(defaultConfig, defaultSpec string, args []string) error {
fs := flag.NewFlagSet("bootstrap", flag.ContinueOnError)
configPath := fs.String("config", defaultConfig, "path to the bootstrap config file")
specPath := fs.String("spec", defaultSpec, "path to the bootstrap spec file")
if err := fs.Parse(args); err != nil {
return err
}
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
return archie.Bootstrap(ctx, *configPath, *specPath)
}
func runBundle(configPath string, args []string) (int, error) {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()