Skip to content

Commit 8763c5a

Browse files
authored
Adding Username support for non-Config File approach (#303)
1 parent e4cba9e commit 8763c5a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,10 +977,11 @@ databases:
977977
978978
#### OCI Vault CLI Configuration
979979
980-
If using the default database with CLI parameters, the exporter will read the password from a secret stored in OCI Vault if you set these two environment variables:
980+
If using the default database with CLI parameters, the exporter will read the username and password from a secret stored in OCI Vault if you set these two environment variables:
981981
982982
- `OCI_VAULT_ID` should be set to the OCID of the OCI vault that you wish to use
983-
- `OCI_VAULT_SECRET_NAME` should be set to the name of the secret in the OCI vault which contains the database password
983+
- `OCI_VAULT_USERNAME_SECRET` should be set to the name of the secret in the OCI vault which contains the database username
984+
- `OCI_VAULT_PASSWORD_SECRET` should be set to the name of the secret in the OCI vault which contains the database password
984985
985986
> Note that the process must be running under a user that has the OCI CLI installed and configured correctly to access the desired tenancy and region. The OCI Profile used is `DEFAULT`.
986987

collector/config.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,9 @@ func (m *MetricsConfiguration) defaultDatabase(cfg *Config) DatabaseConfig {
234234
if ociVaultID, useOciVault := os.LookupEnv("OCI_VAULT_ID"); useOciVault {
235235
dbconfig.Vault = &VaultConfig{
236236
OCI: &OCIVault{
237-
ID: ociVaultID,
238-
// For the CLI, only the password may be loaded from a secret. If you need to load
239-
// both the username and password from OCI Vault, use the exporter configuration file.
240-
PasswordSecret: os.Getenv("OCI_VAULT_SECRET_NAME"),
237+
ID: ociVaultID,
238+
UsernameSecret: os.Getenv("OCI_VAULT_USERNAME_SECRET"),
239+
PasswordSecret: os.Getenv("OCI_VAULT_PASSWORD_SECRET"),
241240
},
242241
}
243242
} else if azVaultID, useAzVault := os.LookupEnv("AZ_VAULT_ID"); useAzVault {

0 commit comments

Comments
 (0)