summary refs log tree commit diff stats
path: root/svc/svc.go
diff options
context:
space:
mode:
Diffstat (limited to 'svc/svc.go')
-rw-r--r--svc/svc.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/svc/svc.go b/svc/svc.go
index 6284239..e5802d2 100644
--- a/svc/svc.go
+++ b/svc/svc.go
@@ -12,28 +12,35 @@ import (
 
 // Start is the initialization function for getwtxt
 func Start() {
+	before := time.Now()
 	initSvc()
 
 	// StrictSlash(true) allows /api and /api/
 	// to serve the same content without duplicating
 	// handlers/paths
 	index := mux.NewRouter().StrictSlash(true)
-	api := index.PathPrefix("/api").Subrouter()
-
-	setIndexRouting(index)
-	setEndpointRouting(api)
 
 	confObj.Mu.RLock()
 	portnum := fmt.Sprintf(":%v", confObj.Port)
+	if !confObj.IsProxied {
+		index.Host(confObj.Instance.URL)
+	}
 	confObj.Mu.RUnlock()
 
-	server := newServer(portnum, index)
+	setIndexRouting(index)
+	api := index.PathPrefix("/api").Subrouter()
+	setEndpointRouting(api)
 
+	server := newServer(portnum, index)
 	log.Printf("*** Listening on %v\n", portnum)
-	log.Printf("*** getwtxt %v Started :: %v ::\n\n", Vers, time.Now().Format(time.RFC3339))
+	log.Printf("*** getwtxt %v Startup finished at %v, took %v\n\n", Vers, time.Now().Format(time.RFC3339), time.Since(before))
 	errLog("", server.ListenAndServe())
 
 	closeLog <- true
+	killTickers()
+	killDB()
+	close(dbChan)
+	close(closeLog)
 }
 
 func newServer(port string, index *mux.Router) *http.Server {
mor/getwtxt/blame/http.go?h=v0.4.13&id=fc49c5701fde7d0c9dd2fa321ba0ebbff712b08a'>^
d3d9df2 ^

1168570 ^

747f4fb ^
1168570 ^


893123c ^
fc49c57 ^
1168570 ^
893123c ^
b9d16fb ^
1168570 ^

747f4fb ^
1168570 ^



b9d16fb ^
d3d9df2 ^
1168570 ^

b6e7bb3 ^
1168570 ^

b9d16fb ^
d3d9df2 ^
505c5d8 ^





1168570 ^

d2680fb ^
1168570 ^


d2680fb ^

1168570 ^

fc49c57 ^
1168570 ^


d6fbc25 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66