commit 07b4475b461fcecec37da5d5878479660167b59f
parent 333bada3a5a4d02b959389a0492cb89b6f5a0609
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Mon, 18 Jul 2022 12:48:07 +0200
minor refactoring
Diffstat:
2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/cmd/taldir-server/main.go b/cmd/taldir-server/main.go
@@ -29,9 +29,17 @@ package main
import (
"flag"
+ "net/http"
+ "log"
"taler.net/taldir/pkg/rest"
)
+var t taldir.Taldir
+
+func handleRequests() {
+ log.Fatal(http.ListenAndServe(t.Cfg.Section("taldir").Key("bind_to").MustString("localhost:11000"), t.Router))
+}
+
func main() {
var cfgFlag = flag.String("c", "", "Configuration file to use")
@@ -42,5 +50,5 @@ func main() {
}
t := taldir.Taldir{}
t.Initialize(cfgfile)
- t.Run()
+ handleRequests()
}
diff --git a/pkg/rest/taldir.go b/pkg/rest/taldir.go
@@ -19,11 +19,8 @@
package taldir
/* TODO
- - ToS API (terms, privacy) with localizions
- ToS compression
- ToS etag
- - Maintenance of database: When to delete expired validations?
- Currently, we expire on startup 1 day old validations
*/
import (
@@ -707,10 +704,6 @@ func (t *Taldir) setupHandlers() {
}
-func (t *Taldir) handleRequests() {
- log.Fatal(http.ListenAndServe(t.Cfg.Section("taldir").Key("bind_to").MustString("localhost:11000"), t.Router))
-}
-
// Initialize the Taldir instance with cfgfile
func (t *Taldir) Initialize(cfgfile string) {
_cfg, err := ini.Load(cfgfile)
@@ -791,9 +784,3 @@ func (t *Taldir) Initialize(cfgfile string) {
t.Merchant = taler.NewMerchant(merchURL, merchToken)
t.setupHandlers()
}
-
-
-// Run the server and listen for requests
-func (t *Taldir) Run() {
- t.handleRequests()
-}