feat: more logging info + loglevel

master
phga 4 years ago
parent 0a1a496ba1
commit 1247847e9a

@ -18,6 +18,7 @@ type Config struct {
DdUsers map[string]map[string]string `json:"dd_users"` DdUsers map[string]map[string]string `json:"dd_users"`
DnsTTL int `json:"dns_ttl"` DnsTTL int `json:"dns_ttl"`
DnsServer string `json:"dns_server"` DnsServer string `json:"dns_server"`
Loglevel string `json:"loglevel"`
} }
var config Config var config Config

@ -22,6 +22,10 @@ func handleDynamicUpdate(w http.ResponseWriter, r *http.Request) {
up := r.URL.Query() up := r.URL.Query()
ip := r.Header.Get("X-FORWARDED-FOR") ip := r.Header.Get("X-FORWARDED-FOR")
if config.Loglevel == "verbose" {
log.Println(up, ip)
}
if len(ip) < 1 { if len(ip) < 1 {
ip = strings.Split(r.RemoteAddr, ":")[0] ip = strings.Split(r.RemoteAddr, ":")[0]
} }

Loading…
Cancel
Save