Sha256: d30195a69a0d7ddcfe96b0089aeb651e98c72aa9efc602631c33d458e58333a0
Contents?: true
Size: 1.91 KB
Versions: 1
Compression:
Stored size: 1.91 KB
Contents
package org.embulk.executor.remoteserver; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Map; public class Launcher { public static void main(String[] args) throws IOException { Map<String, String> envVars = System.getenv(); String host = envVars.getOrDefault("BIND_ADDRESS", "0.0.0.0"); int port = Integer.parseInt(envVars.getOrDefault("PORT", "30001")); int numOfWorkers = Integer.parseInt(envVars.getOrDefault("NUM_OF_WORKERS", "5")); TLSConfig tlsConfig = createTLSConfig(envVars); configureLogLevel(envVars); EmbulkServer.start(host, port, numOfWorkers, tlsConfig); } private static TLSConfig createTLSConfig(Map<String, String> envVars) { if (!"true".equals(envVars.get("USE_TLS"))) { return null; } TLSConfig tlsConfig = new TLSConfig(); String keyP12Path = envVars.get("CERT_P12_PATH"); String keyP12Password = envVars.get("CERT_P12_PASSWORD"); if (keyP12Path != null && keyP12Password != null) { tlsConfig.keyStore(new P12File(keyP12Path, keyP12Password)); } String trustP12Path = envVars.get("CA_P12_PATH"); String trustP12Password = envVars.get("CA_P12_PASSWORD"); if (trustP12Path != null && trustP12Password != null) { tlsConfig.trustStore(new P12File(trustP12Path, trustP12Password)); } if ("true".equals(envVars.get("REQUIRE_TLS_CLIENT_AUTH"))) { tlsConfig.enableClientAuth(true); } return tlsConfig; } private static void configureLogLevel(Map<String, String> envVars) { Level logLevel = Level.toLevel(envVars.getOrDefault("LOG_LEVEL", "info")); Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); rootLogger.setLevel(logLevel); } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
embulk-executor-remoteserver-0.3.2 | src/main/java/org/embulk/executor/remoteserver/Launcher.java |