mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 02:14:54 +00:00
Use VAULT_TOKEN environment variable if it exists (#45525)
(cherry picked from commit b57f2ff68049a4d86ab37399531616b7ad26cfd9)
This commit is contained in:
parent
f4e32a5f5f
commit
45605cfd7a
@ -12,14 +12,16 @@ initscript {
|
|||||||
|
|
||||||
boolean USE_ARTIFACTORY=false
|
boolean USE_ARTIFACTORY=false
|
||||||
|
|
||||||
['VAULT_ADDR', 'VAULT_ROLE_ID', 'VAULT_SECRET_ID'].each {
|
if (System.getenv('VAULT_ADDR') == null) {
|
||||||
if (System.env."$it" == null) {
|
throw new GradleException("You must set the VAULT_ADDR environment variable to use this init script.")
|
||||||
throw new GradleException("$it must be set!")
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final String vaultToken = new Vault(
|
if (System.getenv('VAULT_ROLE_ID') == null && System.getenv('VAULT_SECRET_ID') == null && System.getenv('VAULT_TOKEN') == null) {
|
||||||
|
throw new GradleException("You must set either the VAULT_ROLE_ID and VAULT_SECRET_ID environment variables, " +
|
||||||
|
"or the VAULT_TOKEN environment variable to use this init script.")
|
||||||
|
}
|
||||||
|
|
||||||
|
final String vaultToken = System.getenv('VAULT_TOKEN') ?: new Vault(
|
||||||
new VaultConfig()
|
new VaultConfig()
|
||||||
.address(System.env.VAULT_ADDR)
|
.address(System.env.VAULT_ADDR)
|
||||||
.engineVersion(1)
|
.engineVersion(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user