Skip to content

Commit

Permalink
- Removed no longer used AbstractLocalVaultConfiguration.
Browse files Browse the repository at this point in the history
- Simplified the remaining 3 API usages of VaultUtils.
  • Loading branch information
rfc3092 committed Nov 27, 2024
1 parent ebcf6e5 commit 467c34a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 114 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package no.nav.brregstub;

import no.nav.testnav.libs.vault.VaultUtil;
import no.nav.testnav.libs.vault.VaultUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

Expand All @@ -9,10 +9,8 @@
public class BrregApplicationLauncher {

public static void main(String[] args) {

if ("prod".equals(System.getProperty("spring.profiles.active"))) {
VaultUtil.initCloudVaultToken();
}
VaultUtils.initCloudVaultToken("prod");
SpringApplication.run(BrregApplicationLauncher.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
package no.nav.registre.sdforvalter;

import no.nav.testnav.libs.vault.VaultUtil;
import no.nav.testnav.libs.vault.VaultUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class StatiskDataForvalterApplicationStarter {

public static void main(String[] args) {

if ("prod".equals(System.getProperty("spring.profiles.active"))) {
VaultUtil.initCloudVaultToken();
}
VaultUtils.initCloudVaultToken("prod");
SpringApplication.run(StatiskDataForvalterApplicationStarter.class, args);

}

}
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package no.nav.udistub;

import no.nav.testnav.libs.vault.VaultUtil;
import no.nav.testnav.libs.vault.VaultUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class UdiStubApplicationStarter {

public static void main(String[] args) {

if ("prod".equals(System.getProperty("spring.profiles.active"))) {
VaultUtil.initCloudVaultToken();
}

VaultUtils.initCloudVaultToken("prod");
SpringApplication.run(UdiStubApplicationStarter.class, args);
}

}
20 changes: 0 additions & 20 deletions docs/local_vault.md

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@NoArgsConstructor(access = PRIVATE)
@Slf4j
public final class VaultUtil {
public final class VaultUtils {

private static final String NAIS_CLUSTER_SYSTEM_PROPERTY = "NAIS_CLUSTER_NAME";
private static final String VAULT_TOKEN_SYSTEM_PROPERTY = "spring.cloud.vault.token";
Expand Down Expand Up @@ -49,8 +49,10 @@ private static String getVaultToken() {

}

public static void initCloudVaultToken() {
System.setProperty(VAULT_TOKEN_SYSTEM_PROPERTY, getVaultToken());
public static void initCloudVaultToken(String ifProfileIs) {
if (ifProfileIs.equals(System.getProperty("spring.profiles.active"))) {
System.setProperty(VAULT_TOKEN_SYSTEM_PROPERTY, getVaultToken());
}
}

}

0 comments on commit 467c34a

Please sign in to comment.