Bootstrap secrets for shared configuration acquisition
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package appconfig
|
||||
|
||||
import (
|
||||
"context"
|
||||
ck "go.maximumdirect.net/configkit"
|
||||
"io/fs"
|
||||
"os"
|
||||
@@ -23,7 +24,7 @@ func TestMainContextImportsAndOverlay(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
result, err := Load(ck.Input{Source: ck.File(filepath.Join(dir, "main.yml"))}, "selected", ck.Override{Path: ck.Keys("context", "description"), Value: "override", Flag: "--description"})
|
||||
result, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "main.yml"))}, "selected", ck.Override{Path: ck.Keys("context", "description"), Value: "override", Flag: "--description"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -50,10 +51,10 @@ func TestMainContextImportsAndOverlay(t *testing.T) {
|
||||
if !found {
|
||||
t.Fatal("main source missing")
|
||||
}
|
||||
if _, err := Load(ck.Input{Source: ck.File(filepath.Join(dir, "main.yml"))}, "missing"); err == nil {
|
||||
if _, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "main.yml"))}, "missing"); err == nil {
|
||||
t.Fatal("missing overlay accepted")
|
||||
}
|
||||
if _, err := Load(ck.Input{Source: ck.NoSource()}, "selected"); err == nil {
|
||||
if _, _, err := Load(context.Background(), ck.Input{Source: ck.NoSource()}, "selected"); err == nil {
|
||||
t.Fatal("overlay without context accepted")
|
||||
}
|
||||
}
|
||||
@@ -62,7 +63,8 @@ func TestDiscoveryAndSelectedFailure(t *testing.T) {
|
||||
first, second := t.TempDir(), t.TempDir()
|
||||
search := ck.Searches(ck.SearchDirectory(first), ck.SearchDirectory(second))
|
||||
load := func() (*ck.Result[Config], error) {
|
||||
return Load(ck.Input{Source: ck.SearchConfig("audita", search)}, "")
|
||||
result, _, err := Load(context.Background(), ck.Input{Source: ck.SearchConfig("audita", search)}, "")
|
||||
return result, err
|
||||
}
|
||||
result, err := load()
|
||||
if err != nil {
|
||||
@@ -103,7 +105,7 @@ func TestOverlayUsesMainDirectoryWithinWiderRoot(t *testing.T) {
|
||||
if err := os.WriteFile(filepath.Join(dir, "overlays", "local.yml"), []byte("context:\n description: project\n"), 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
result, err := Load(ck.Input{Source: ck.File(filepath.Join(dir, "config.yml")), Filesystem: &ck.FilesystemContext{Root: root}}, "local")
|
||||
result, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml")), Filesystem: &ck.FilesystemContext{Root: root}}, "local")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user