forked from facesea/banshee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
43 lines (34 loc) · 1.11 KB
/
config.go
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
// Copyright 2015 Eleme Inc. All rights reserved.
package webapp
import (
"github.com/julienschmidt/httprouter"
"net/http"
)
// getConfig returns config.
func getConfig(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
c := cfg.Copy()
c.Webapp.Auth[0] = "******"
c.Webapp.Auth[1] = "******"
ResponseJSONOK(w, c)
}
// getInterval returns config.interval.
type intervalResponse struct {
Interval uint32 `json:"interval"`
}
func getInterval(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
ResponseJSONOK(w, &intervalResponse{cfg.Interval})
}
// getLanguage returns config.webapp.language.
type languageResponse struct {
Language string `json:"language"`
}
func getLanguage(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
ResponseJSONOK(w, &languageResponse{cfg.Webapp.Language})
}
// getPrivateDocURL returns config.webapp.privateDocUrl.
type privateDocURLResponse struct {
PrivateDocURL string `json:"privateDocUrl"`
}
func getPrivateDocURL(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
ResponseJSONOK(w, &privateDocURLResponse{cfg.Webapp.PrivateDocURL})
}