| .. | .. |
|---|
| 12 | 12 |
|
|---|
| 13 | 13 | import net.curisit.securis.ioc.RequestsModule;
|
|---|
| 14 | 14 | import net.curisit.securis.ioc.SecurisModule;
|
|---|
| 15 | +import net.curisit.securis.utils.Config;
|
|---|
| 15 | 16 |
|
|---|
| 16 | 17 | import org.apache.commons.io.FileUtils;
|
|---|
| 17 | 18 | import org.apache.logging.log4j.LogManager;
|
|---|
| .. | .. |
|---|
| 149 | 150 | QueuedThreadPool threadPool = new QueuedThreadPool();
|
|---|
| 150 | 151 | threadPool.setMaxThreads(50);
|
|---|
| 151 | 152 |
|
|---|
| 152 | | - server = new Server(9997);
|
|---|
| 153 | + server = new Server(Config.getInt(Config.KEYS.SERVER_PORT, 9080));
|
|---|
| 153 | 154 | ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
|
|---|
| 154 | 155 | context.setContextPath("/");
|
|---|
| 155 | 156 | context.addEventListener(injector.getInstance(GuiceResteasyBootstrapServletContextListener.class));
|
|---|
| .. | .. |
|---|
| 184 | 185 |
|
|---|
| 185 | 186 | HttpConfiguration http_config = new HttpConfiguration();
|
|---|
| 186 | 187 | http_config.setSecureScheme("https");
|
|---|
| 187 | | - http_config.setSecurePort(8443);
|
|---|
| 188 | + http_config.setSecurePort(Config.getInt(Config.KEYS.SERVER_SSL_PORT, 9443));
|
|---|
| 188 | 189 | http_config.setOutputBufferSize(32768);
|
|---|
| 189 | 190 | http_config.setSendServerVersion(true);
|
|---|
| 190 | 191 | http_config.setSendDateHeader(false);
|
|---|
| .. | .. |
|---|
| 194 | 195 | https_config.addCustomizer(new SecureRequestCustomizer());
|
|---|
| 195 | 196 |
|
|---|
| 196 | 197 | SslContextFactory sslContextFactory = new SslContextFactory();
|
|---|
| 197 | | - sslContextFactory.setKeyStorePath("/Users/rob/.ssh/keys/securis.pkcs12");
|
|---|
| 198 | | - sslContextFactory.setKeyStoreType("PKCS12");
|
|---|
| 199 | | - sslContextFactory.setKeyStorePassword("curist3c");
|
|---|
| 198 | + sslContextFactory.setKeyStorePath(Config.get(Config.KEYS.KEYSTORE_PATH));
|
|---|
| 199 | + sslContextFactory.setKeyStoreType(Config.get(Config.KEYS.KEYSTORE_TYPE, "JKS"));
|
|---|
| 200 | + sslContextFactory.setKeyStorePassword(Config.get(Config.KEYS.KEYSTORE_PASSWORD, ""));
|
|---|
| 200 | 201 | //sslContextFactory.setCertAlias("1");
|
|---|
| 201 | 202 | // sslContextFactory.setKeyManagerPassword("curist3c");
|
|---|
| 202 | 203 | // sslContextFactory.setTrustStorePath("/Users/rob/.ssh/keys/keystore");
|
|---|
| .. | .. |
|---|
| 206 | 207 | LOG.info("Protocol: {}", sslContextFactory.getProtocol());
|
|---|
| 207 | 208 |
|
|---|
| 208 | 209 | ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory,HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(https_config));
|
|---|
| 209 | | - sslConnector.setPort(8443);
|
|---|
| 210 | | - sslConnector.setHost("securis.curistec.com");
|
|---|
| 210 | + sslConnector.setPort(Config.getInt(Config.KEYS.SERVER_SSL_PORT, 9443));
|
|---|
| 211 | + sslConnector.setHost(Config.get(Config.KEYS.SERVER_HOSTNAME, "0.0.0.0"));
|
|---|
| 211 | 212 | server.addConnector( sslConnector );
|
|---|
| 212 | 213 |
|
|---|
| 213 | 214 | server.setHandler(context);
|
|---|