Model Vault
vault::Vault
Parameters
↳ const address: string
↳ const auth: string = "token"
↳ const auth_mount: string = ""
↳ const cache_ttl: u64 = 300
↳ const github_audience: string = ""
↳ const github_token: Secret<string> = <secret "env:MELODIUM_SECRET_ACTIONS_ID_TOKEN_REQUEST_TOKEN">
↳ const jwt: Secret<string> = <secret "env:MELODIUM_SECRET_VAULT_ID_TOKEN">
↳ const kubernetes_token: Secret<string> = <secret "file:/var/run/secrets/kubernetes.io/serviceaccount/token">
↳ const namespace: string = ""
↳ const prefetch: string = ""
↳ const role: string = ""
↳ const role_id: Secret<string> = <secret "env:MELODIUM_SECRET_VAULT_ROLE_ID">
↳ const secret_id: Secret<string> = <secret "env:MELODIUM_SECRET_VAULT_SECRET_ID">
↳ const source: string = "vault"
↳ const token: Secret<string> = <secret "env:MELODIUM_SECRET_VAULT_TOKEN">
HashiCorp Vault or OpenBao server, providing secrets.
The model registers a secret source named source, so that secrets located as
vault:<path>#<field> are read from the server when revealed, such as
vault:kv/data/app/db#password for the password field of the app/db key/value
secret in a kv engine. The field can be omitted if the secret has only one.
address: address of the server, such ashttps://vault.example.com:8200.source: name of the source, the scheme of locators (vaultby default); two models with the same source, or a source namedenvorfile, make the launch fail.namespace: namespace to work in, if any.
Authentication is chosen by auth:
token: usestokenas client token.approle: logs in withrole_idandsecret_id.kubernetes: logs in asrolewith the service account tokenkubernetes_token.jwt: logs in asrolewith thejwttoken, such as a GitLab CI ID token.github: logs in asrolewith a GitHub Actions OIDC token, requested for thegithub_audienceaudience usinggithub_token.
auth_mount is the path where the authentication method is enabled, by default
approle, kubernetes or jwt (also for github).
Credentials are secrets, by default read from the usual environment variables,
prefixed with MELODIUM_SECRET_ as programs only get those
(MELODIUM_SECRET_VAULT_TOKEN, MELODIUM_SECRET_VAULT_ROLE_ID,
MELODIUM_SECRET_VAULT_SECRET_ID, MELODIUM_SECRET_VAULT_ID_TOKEN,
MELODIUM_SECRET_ACTIONS_ID_TOKEN_REQUEST_TOKEN), and from the Kubernetes service
account token file.
The model reveals them as vault::Vault, so they can be restricted to it
with std/secret::|reveal_only_by.
Read secrets are kept for cache_ttl seconds (0 disables caching).
prefetch lists the paths of secrets to read at startup, separated by spaces.
Running with --check-secrets also reads the secrets given as parameters at startup.