mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-15 19:31:45 +03:00
fe8be3701f
Merge in DNS/adguard-home from websvc-config-manager to master Squashed commit of the following: commit 2143b47c6528030dfe059172888fddf9061e42da Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Oct 4 14:50:47 2022 +0300 next: add config manager
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package websvc
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// All Settings Handlers
|
|
|
|
// RespGetV1SettingsAll describes the response of the GET /api/v1/settings/all
|
|
// HTTP API.
|
|
type RespGetV1SettingsAll struct {
|
|
// TODO(a.garipov): Add more as we go.
|
|
|
|
DNS *HTTPAPIDNSSettings `json:"dns"`
|
|
HTTP *HTTPAPIHTTPSettings `json:"http"`
|
|
}
|
|
|
|
// handleGetSettingsAll is the handler for the GET /api/v1/settings/all HTTP
|
|
// API.
|
|
func (svc *Service) handleGetSettingsAll(w http.ResponseWriter, r *http.Request) {
|
|
dnsSvc := svc.confMgr.DNS()
|
|
dnsConf := dnsSvc.Config()
|
|
|
|
webSvc := svc.confMgr.Web()
|
|
httpConf := webSvc.Config()
|
|
|
|
// TODO(a.garipov): Add all currently supported parameters.
|
|
writeJSONOKResponse(w, r, &RespGetV1SettingsAll{
|
|
DNS: &HTTPAPIDNSSettings{
|
|
Addresses: dnsConf.Addresses,
|
|
BootstrapServers: dnsConf.BootstrapServers,
|
|
UpstreamServers: dnsConf.UpstreamServers,
|
|
UpstreamTimeout: JSONDuration(dnsConf.UpstreamTimeout),
|
|
},
|
|
HTTP: &HTTPAPIHTTPSettings{
|
|
Addresses: httpConf.Addresses,
|
|
SecureAddresses: httpConf.SecureAddresses,
|
|
Timeout: JSONDuration(httpConf.Timeout),
|
|
ForceHTTPS: httpConf.ForceHTTPS,
|
|
},
|
|
})
|
|
}
|