io.quarkus.vault.runtime.config.VaultConfigSource Maven / Gradle / Ivy
package io.quarkus.vault.runtime.config;
import static io.quarkus.vault.runtime.config.VaultCacheEntry.tryReturnLastKnownValue;
import static java.util.Collections.emptyMap;
import static java.util.stream.Collectors.toMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.microprofile.config.spi.ConfigSource;
import org.jboss.logging.Logger;
import io.quarkus.arc.Arc;
import io.quarkus.vault.VaultKVSecretEngine;
public class VaultConfigSource implements ConfigSource {
private static final Logger log = Logger.getLogger(VaultConfigSource.class);
private AtomicReference>> cache = new AtomicReference<>(null);
private VaultBootstrapConfig vaultBootstrapConfig;
public VaultConfigSource(VaultBootstrapConfig vaultBootstrapConfig) {
this.vaultBootstrapConfig = vaultBootstrapConfig;
}
@Override
public String getName() {
return VaultBootstrapConfig.NAME;
}
@Override
public int getOrdinal() {
return vaultBootstrapConfig.configOrdinal;
}
/**
* always return an empty map to protect from accidental properties logging
*
* @return empty map
*/
@Override
public Map getProperties() {
return emptyMap();
}
@Override
public String getValue(String propertyName) {
return vaultBootstrapConfig.url.isPresent() ? getSecretConfig().get(propertyName) : null;
}
private Map getSecretConfig() {
VaultCacheEntry
© 2015 - 2025 Weber Informatics LLC | Privacy Policy