41 lines
934 B
HCL
41 lines
934 B
HCL
# Vault Agent Configuration - App Runtime
|
|
# Uses nexus-app role: database/creds/nexus-app (1h TTL) + secret/data/nexus/*
|
|
|
|
pid_file = "/tmp/vault-agent.pid"
|
|
|
|
vault {
|
|
address = "http://vault.example.local:8200"
|
|
}
|
|
|
|
auto_auth {
|
|
method "approle" {
|
|
config = {
|
|
role_id_file_path = "/vault/role-id"
|
|
secret_id_file_path = "/vault/secret-id"
|
|
remove_secret_id_file_after_reading = false
|
|
}
|
|
}
|
|
|
|
sink "file" {
|
|
config = {
|
|
path = "/vault/token"
|
|
mode = 0644
|
|
}
|
|
}
|
|
}
|
|
|
|
template_config {
|
|
static_secret_render_interval = "5m"
|
|
exit_on_retry_failure = true
|
|
}
|
|
|
|
template {
|
|
source = "/vault/templates/env.ctmpl"
|
|
destination = "/vault/secrets/.env"
|
|
perms = 0644
|
|
|
|
exec {
|
|
command = ["sh", "-c", "PID=$(cat /vault/secrets/nexus.pid 2>/dev/null); echo \"Sending SIGHUP to PID: $PID\"; kill -HUP $PID && echo 'SIGHUP sent successfully' || echo 'Failed to send SIGHUP'"]
|
|
}
|
|
}
|