Bootstrap secrets before configuration loading

This commit is contained in:
2026-09-07 04:13:58 +00:00
parent f0225e937c
commit d31ba5a410
41 changed files with 399 additions and 656 deletions

View File

@@ -2,8 +2,8 @@ package app
import (
"context"
"os"
configkit "gitea.maximumdirect.net/eric/ConfigKit"
"gitea.maximumdirect.net/eric/narratio/internal/adapters/storage"
"gitea.maximumdirect.net/eric/narratio/internal/config"
)
@@ -11,7 +11,8 @@ import (
type commandDependencies struct {
loadPipelineConfig func(string, config.PipelineLoadOptions) (*config.PipelineConfig, error)
downloadObjectToTemp func(context.Context, storage.ObjectStore, string, string) (string, error)
readSecretsDirectory func(string) ([]os.DirEntry, error)
loadSecretsDir func(string) (*configkit.SecretsReport, error)
secretsBootstrap *secretsBootstrap
newObjectStore func(context.Context, *config.Config) (storage.ObjectStore, error)
discoverRemoteCurrentState func(context.Context, *config.Config, storage.ObjectStore) (*RemoteCurrentState, error)
buildRestorePlan func(context.Context, *config.Config, *RemoteCurrentState, storage.ObjectStore, RestorePlanOptions) (*RestorePlan, error)
@@ -25,8 +26,11 @@ func normalizeCommandDependencies(deps commandDependencies) commandDependencies
if deps.downloadObjectToTemp == nil {
deps.downloadObjectToTemp = storage.DownloadObjectToTemp
}
if deps.readSecretsDirectory == nil {
deps.readSecretsDirectory = os.ReadDir
if deps.loadSecretsDir == nil {
deps.loadSecretsDir = configkit.LoadSecretsDir
}
if deps.secretsBootstrap == nil {
deps.secretsBootstrap = &secretsBootstrap{}
}
if deps.newObjectStore == nil {
deps.newObjectStore = storage.NewObjectStoreFromConfig