feat: parse bitwarden cache manifest option
This commit is contained in:
parent
e5f2244ad8
commit
9675490cd3
2 changed files with 50 additions and 1 deletions
|
|
@ -49,7 +49,8 @@ type Environment struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type SecretStore struct {
|
type SecretStore struct {
|
||||||
BackendPolicy string `toml:"backend_policy"`
|
BackendPolicy string `toml:"backend_policy"`
|
||||||
|
BitwardenCache *bool `toml:"bitwarden_cache"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Profiles struct {
|
type Profiles struct {
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,54 @@ description = " Client MCP interne "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLoadParsesSecretStoreBitwardenCache(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
path := filepath.Join(dir, DefaultFile)
|
||||||
|
|
||||||
|
const content = `
|
||||||
|
[secret_store]
|
||||||
|
backend_policy = "bitwarden-cli"
|
||||||
|
bitwarden_cache = false
|
||||||
|
`
|
||||||
|
|
||||||
|
if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
|
||||||
|
t.Fatalf("WriteFile manifest: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
file, err := Load(path)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Load returned error: %v", err)
|
||||||
|
}
|
||||||
|
if file.SecretStore.BitwardenCache == nil {
|
||||||
|
t.Fatal("bitwarden cache option is nil, want explicit false pointer")
|
||||||
|
}
|
||||||
|
if *file.SecretStore.BitwardenCache {
|
||||||
|
t.Fatal("bitwarden cache option = true, want false")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLoadLeavesOmittedBitwardenCacheUnset(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
path := filepath.Join(dir, DefaultFile)
|
||||||
|
|
||||||
|
const content = `
|
||||||
|
[secret_store]
|
||||||
|
backend_policy = "bitwarden-cli"
|
||||||
|
`
|
||||||
|
|
||||||
|
if err := os.WriteFile(path, []byte(content), 0o600); err != nil {
|
||||||
|
t.Fatalf("WriteFile manifest: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
file, err := Load(path)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Load returned error: %v", err)
|
||||||
|
}
|
||||||
|
if file.SecretStore.BitwardenCache != nil {
|
||||||
|
t.Fatalf("bitwarden cache option = %v, want nil when omitted", *file.SecretStore.BitwardenCache)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestLoadParsesConfigFields(t *testing.T) {
|
func TestLoadParsesConfigFields(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
path := filepath.Join(dir, DefaultFile)
|
path := filepath.Join(dir, DefaultFile)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue