Skip to content

Commit

Permalink
adding ovh-dev endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasBassoOcto authored May 30, 2024
1 parent 7ef827a commit 9f758e3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/api/vault/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ class VaultModule {
private readonly vaultRole: string;
private isKubelogged: boolean;

constructor(vaultRole: string) {
constructor(vaultRole: string, endpoint: string) {
this.vaultClient = vault({
apiVersion: "v1",
endpoint: "https://vault-dev.factory.social.gouv.fr",
});
this.vaultRole = vaultRole;
this.path = endpoint;
this.isKubelogged = false;
}

Expand All @@ -26,6 +27,7 @@ class VaultModule {
const result = await this.vaultClient.kubernetesLogin({
role: this.vaultRole,
jwt: jwt.toString(),
path: this.endpoint,
});
this.vaultClient.token = result.auth.client_token;
} catch (error) {
Expand Down Expand Up @@ -53,7 +55,7 @@ class VaultModule {
export const dynamic = "force-dynamic";

export async function GET() {
const vaultModule = new VaultModule("fabrique-carnets-vault");
const vaultModule = new VaultModule("fabrique-carnets-vault", "ovh-dev");
try {
const secretData = await vaultModule.readSecret(
"secret/fabrique/dev/data/toto",
Expand Down

0 comments on commit 9f758e3

Please sign in to comment.