Added (optional) publicUrl to vault-backend plugin

Signed-off-by: Casper Thygesen <cth@trifork.com>
This commit is contained in:
Casper Thygesen
2022-12-01 10:33:59 +00:00
parent 80d9674a4a
commit 568ae02463
5 changed files with 22 additions and 3 deletions
@@ -27,6 +27,11 @@ export interface VaultConfig {
*/
baseUrl: string;
/**
* The publicUrl for your Vault instance (Optional).
*/
publicUrl?: string;
/**
* The token used by Backstage to access Vault.
*/
@@ -135,11 +135,13 @@ export class VaultClient implements VaultApi {
)),
);
} else {
const vaultUrl =
this.vaultConfig.publicUrl || this.vaultConfig.baseUrl;
secrets.push({
name: secret,
path: secretPath,
editUrl: `${this.vaultConfig.baseUrl}/ui/vault/secrets/${this.vaultConfig.secretEngine}/edit/${secretPath}/${secret}`,
showUrl: `${this.vaultConfig.baseUrl}/ui/vault/secrets/${this.vaultConfig.secretEngine}/show/${secretPath}/${secret}`,
editUrl: `${vaultUrl}/ui/vault/secrets/${this.vaultConfig.secretEngine}/edit/${secretPath}/${secret}`,
showUrl: `${vaultUrl}/ui/vault/secrets/${this.vaultConfig.secretEngine}/show/${secretPath}/${secret}`,
});
}
}),