Skip to content
Snippets Groups Projects
Commit f0e46858 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-3322 load cert file programmatically

parent 1d749f16
No related branches found
No related tags found
No related merge requests found
package de.itvsh.kop.user;
import java.io.IOException;
import java.nio.charset.Charset;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import org.apache.commons.io.IOUtils;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import io.quarkus.runtime.StartupEvent;
@ApplicationScoped
class MongodbCertificateLoader {
@ConfigProperty(defaultValue = "/certs/pluto-database-tls-cert.crt")
String mongoDbCaCert;
void onStart(@Observes StartupEvent ev) throws KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException {
System.out.println("loading cert...");
KeyStore keystore = KeyStore.getInstance("pkcs12");
keystore.load(IOUtils.toInputStream(mongoDbCaCert, Charset.defaultCharset()), null);
System.out.println("cert loaded");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment