summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-07-19 16:20:58 +0200
committerMartin Schanzenbach <schanzen@gnunet.org>2022-07-19 16:20:58 +0200
commitea15262a4c7430f0d841b69256c572089ba97317 (patch)
treed43422e31f4657119fd61a96981e2e92cd3db042 /cmd
downloadtaler-mailbox-ea15262a4c7430f0d841b69256c572089ba97317.tar.gz
taler-mailbox-ea15262a4c7430f0d841b69256c572089ba97317.tar.bz2
taler-mailbox-ea15262a4c7430f0d841b69256c572089ba97317.zip
initial commit from taldir template
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mailbox-server/main.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/cmd/mailbox-server/main.go b/cmd/mailbox-server/main.go
new file mode 100644
index 0000000..070b7af
--- /dev/null
+++ b/cmd/mailbox-server/main.go
@@ -0,0 +1,46 @@
+// This file is part of taler-mailbox, the Taler Mailbox implementation.
+// Copyright (C) 2022 Martin Schanzenbach
+//
+// Taler-mailbox is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License,
+// or (at your option) any later version.
+//
+// Taler-mailbox is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// SPDX-License-Identifier: AGPL3.0-or-later
+
+package main
+
+import (
+ "flag"
+ "log"
+ "net/http"
+
+ mailbox "taler.net/taler-mailbox/pkg/rest"
+)
+
+var m mailbox.Mailbox
+
+func handleRequests() {
+ log.Fatal(http.ListenAndServe(m.Cfg.Section("mailbox").Key("bind_to").MustString("localhost:11000"), m.Router))
+}
+
+func main() {
+ var cfgFlag = flag.String("c", "", "Configuration file to use")
+
+ flag.Parse()
+ cfgfile := "mailbox.conf"
+ if len(*cfgFlag) != 0 {
+ cfgfile = *cfgFlag
+ }
+ m := mailbox.Mailbox{}
+ m.Initialize(cfgfile)
+ handleRequests()
+}