Add secrets directory credential resolver

This commit is contained in:
2026-05-31 17:00:47 +00:00
parent 84f77ec0d0
commit 052aa8a64a
14 changed files with 665 additions and 6 deletions

View File

@@ -33,6 +33,29 @@ pipelines:
if got, want := destination.Transfer.OnDestinationOlder, TransferActionReplace; got != want {
t.Fatalf("transfer default = %q, want %q", got, want)
}
if cfg.Secrets.Directory != "" {
t.Fatalf("secrets.directory = %q, want empty", cfg.Secrets.Directory)
}
}
func TestLoadFileValidSecretsDirectoryConfig(t *testing.T) {
cfg := loadConfig(t, `
secrets:
directory: /run/secrets/distributor
pipelines:
- id: local-copy
source:
backend: local
path: /var/spool/reports
destinations:
- id: archive
backend: local
path: /srv/archive
`)
if got, want := cfg.Secrets.Directory, "/run/secrets/distributor"; got != want {
t.Fatalf("secrets.directory = %q, want %q", got, want)
}
}
func TestLoadFileValidFanOutConfig(t *testing.T) {
@@ -351,6 +374,23 @@ pipelines:
`, "field surprise not found")
}
func TestLoadFileRejectsUnknownSecretsFields(t *testing.T) {
assertLoadError(t, `
secrets:
directory: /run/secrets/distributor
surprise: true
pipelines:
- id: reports
source:
backend: local
path: /source
destinations:
- id: archive
backend: local
path: /archive
`, "field surprise not found")
}
func TestExampleConfigsLoad(t *testing.T) {
for _, path := range []string{
"../../examples/local-to-local.yml",