Commit 67968ac4 authored by Mio Iwakura's avatar Mio Iwakura

Nightly

parent 8ad1e5d2
......@@ -22,8 +22,8 @@ enum http_port = 80;
enum https_port = 443;
}
enum dhparam_path = "dhparam.pem";
string certificate_chain_path = import ("certificate_chain_path").strip;
string private_key_path = import ("private_key_path").strip;
enum certificate_chain_path = import ("certificate_chain_path").strip;
enum private_key_path = import ("private_key_path").strip;
//@NOTE: can't regex match from countries.dt at compile-time because D sucks
immutable RedBlackTree!string countries = import ("countries.txt")
.lineSplitter
......@@ -88,11 +88,10 @@ void main()
httpsSettings.tlsContext = createTLSContext(TLSContextKind.server, TLSVersion.tls1_2);
httpsSettings.tlsContext.setCipherList(ciphers);
httpsSettings.tlsContext.setDHParams(dhparam_path);
reloadCerts();
httpsRouter = new URLRouter;
httpsRouter.registerWebInterface(new WebInterface);
httpsRouter.get("*", serveStaticFiles("public/"));
httpsListener = listenHTTP(httpsSettings, httpsRouter);
reloadCerts();
scope (exit) httpsListener.stopListening();
auto httpRouter = new URLRouter;
httpRouter.any("/.well_known/acme-challenge/*", serveStaticFiles("public/"));
......@@ -419,13 +418,13 @@ class WebInterface
}
void reloadCerts() nothrow @safe
{
certificate_chain_path = certificate_chain_path.findCert;
private_key_path = private_key_path.findCert;
auto certificate_chain = certificate_chain_path.findCert;
auto private_key = private_key_path.findCert;
try
{
httpsSettings.tlsContext.useCertificateChainFile(certificate_chain);
httpsSettings.tlsContext.usePrivateKeyFile(private_key);
httpsListener.stopListening();
httpsSettings.tlsContext.useCertificateChainFile(certificate_chain_path);
httpsSettings.tlsContext.usePrivateKeyFile(private_key_path);
httpsListener = listenHTTP(httpsSettings, httpsRouter);
}
catch (Exception e)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment