@Test void shouldWorkWhenRegistryIsReloadedAndVaultIsRunning() throws InterruptedException { VaultInstance vaultInstance = vaultContainerExtension.startNewVaultInstance(); vaultInstance.putSecrets( VAULT_SECRETS_PATH1, "top_secret=password1", "db_password=dbpassword1"); String address = vaultInstance.address(); String rootToken = vaultInstance.rootToken(); ConfigRegistrySettings settings = ConfigRegistrySettings.builder() .addLastSource( "vault", VaultConfigSource.builder() .config(vaultConfig -> vaultConfig.address(address).token(rootToken)) .addSecretsPath(VAULT_SECRETS_PATH1) .build()) .jmxEnabled(false) .reloadIntervalSec(1) .build(); ConfigRegistry configRegistry = ConfigRegistry.create(settings); StringConfigProperty configProperty = configRegistry.stringProperty("top_secret"); assertThat(configProperty.value().get(), containsString("password1")); vaultInstance.putSecrets(VAULT_SECRETS_PATH1, " top_secret=new_password"); TimeUnit.SECONDS.sleep(2); assertThat(configProperty.value().get(), containsString("new_password")); }
public static Builder builder() { return new Builder(); }
VaultConfigSource implements ConfigSource { public static Builder builder() { return new Builder(); } }
VaultConfigSource implements ConfigSource { public static Builder builder() { return new Builder(); } private  VaultConfigSource(VaultInvoker vault, Collection<String> secretsPaths); }
VaultConfigSource implements ConfigSource { public static Builder builder() { return new Builder(); } private  VaultConfigSource(VaultInvoker vault, Collection<String> secretsPaths); @Override Map<String, ConfigProperty> loadConfig(); static Builder builder(); }
VaultConfigSource implements ConfigSource { public static Builder builder() { return new Builder(); } private  VaultConfigSource(VaultInvoker vault, Collection<String> secretsPaths); @Override Map<String, ConfigProperty> loadConfig(); static Builder builder();  }