chore(framework): canonize Vault-as-SSOT + ESO-default secrets policy #519

Open
jason.woltje wants to merge 2 commits from chore/canonize-vault-secrets-policy into main
2 changed files with 28 additions and 8 deletions
Showing only changes of commit e88a89f34d - Show all commits

View File

@@ -355,7 +355,6 @@ package config
import (
"fmt"
"os"
"github.com/kelseyhightower/envconfig"
)
@@ -373,10 +372,16 @@ func Load() (*Config, error) {
}
return &cfg, nil
}
```
// In main():
// cfg, err := config.Load()
// if err != nil { fmt.Fprintln(os.Stderr, err); os.Exit(1) }
In your `main.go`:
```go
cfg, err := config.Load()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
```
---
@@ -399,7 +404,12 @@ Use this pattern ONLY when a documented dynamic-secrets requirement applies (DB
vault auth enable approle
# Create a Vault policy for the app
# Note: KV v2 paths require both the exact path (for the top-level secret) and the
# wildcard (for sub-paths). Always include both to avoid permission denied errors.
vault policy write <app>-policy - <<EOF
path "secret/data/k3s/<app>" {
capabilities = ["read"]
}
path "secret/data/k3s/<app>/*" {
capabilities = ["read"]
}

View File

@@ -355,7 +355,6 @@ package config
import (
"fmt"
"os"
"github.com/kelseyhightower/envconfig"
)
@@ -373,10 +372,16 @@ func Load() (*Config, error) {
}
return &cfg, nil
}
```
// In main():
// cfg, err := config.Load()
// if err != nil { fmt.Fprintln(os.Stderr, err); os.Exit(1) }
In your `main.go`:
```go
cfg, err := config.Load()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
```
---
@@ -399,7 +404,12 @@ Use this pattern ONLY when a documented dynamic-secrets requirement applies (DB
vault auth enable approle
# Create a Vault policy for the app
# Note: KV v2 paths require both the exact path (for the top-level secret) and the
# wildcard (for sub-paths). Always include both to avoid permission denied errors.
vault policy write <app>-policy - <<EOF
path "secret/data/k3s/<app>" {
capabilities = ["read"]
}
path "secret/data/k3s/<app>/*" {
capabilities = ["read"]
}