forked from facesea/banshee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
39 lines (31 loc) · 999 Bytes
/
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
// 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})
}
// getNoice returns config.webapp.notice.
func getNotice(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
ResponseJSONOK(w, cfg.Webapp.Notice)
}
// 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})
}