diff options
| author | 2019-02-26 23:39:28 -0500 | |
|---|---|---|
| committer | 2019-02-26 23:39:28 -0500 | |
| commit | e63266d60ea5d445110cd0fde64c129a97dc45af (patch) | |
| tree | 163c56e17ec71b39ef938ff6841cbaa0614864e1 | |
| parent | Always use language (diff) | |
Switch to Vibe's Default Main
Also, change default bindings and add defaults to options
| -rw-r--r-- | dub.sdl | 2 | ||||
| -rw-r--r-- | source/app.d | 13 |
2 files changed, 6 insertions, 9 deletions
@@ -4,3 +4,5 @@ authors "Chloe Kudryavtsev" copyright "Copyright © 2019, Chloe Kudryavtsev" license "MIT" dependency "vibe-d" version="~>0.8.5-beta.2" + +versions "VibeDefaultMain" diff --git a/source/app.d b/source/app.d index 7b7c3fd..c6ac6c5 100644 --- a/source/app.d +++ b/source/app.d @@ -2,21 +2,16 @@ import brpaste; import vibe.d; -int main(string[] args) -{ +shared static this() { auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = []; - readOption("bind|b", &settings.bindAddresses, "Sets the address to bind to"); - readOption("port|p", &settings.port, "Sets the port to listen on"); - if(settings.bindAddresses.length == 0) settings.bindAddresses = [ "127.0.0.1" ]; + readOption("bind|b", &settings.bindAddresses, "Sets the addresses to bind to [127.0.0.1 ::1]"); + readOption("port|p", &settings.port, "Sets the port to listen on [8080]"); + if(settings.bindAddresses.empty) settings.bindAddresses = [ "127.0.0.1", "::1" ]; auto router = new URLRouter; router.registerWebInterface(new BRPaste); listenHTTP(settings, router); - - import std.conv; - logInfo("Please open http://%s:%d/ in your browser.", settings.bindAddresses[0], settings.port); - return runApplication(); } |
