diff --git a/servers/api.go b/servers/api.go index 60a3fe3..51f4150 100644 --- a/servers/api.go +++ b/servers/api.go @@ -38,6 +38,7 @@ func NewApiServer(conf *Conf, compileTarget utils.MultiCompilable) *http.Server // add domain with active state q := req.URL.Query() conf.Domains.Put(params.ByName("domain"), q.Get("active") == "1") + conf.Domains.Compile() }) r.DELETE("/domain/:domain", func(rw http.ResponseWriter, req *http.Request, params httprouter.Params) { if !hasPerms(conf.Verify, req, "violet:domains") { @@ -48,6 +49,7 @@ func NewApiServer(conf *Conf, compileTarget utils.MultiCompilable) *http.Server // add domain with active state q := req.URL.Query() conf.Domains.Put(params.ByName("domain"), q.Get("active") == "1") + conf.Domains.Compile() }) // Endpoint for acme-challenge diff --git a/servers/conf.go b/servers/conf.go index f6f738d..b6fd22d 100644 --- a/servers/conf.go +++ b/servers/conf.go @@ -29,6 +29,7 @@ type DomainProvider interface { IsValid(host string) bool Put(domain string, active bool) Delete(domain string) + Compile() } type AcmeChallengeProvider interface { diff --git a/utils/response.go b/utils/response.go index 4a54287..48eb158 100644 --- a/utils/response.go +++ b/utils/response.go @@ -7,7 +7,7 @@ import ( // RespondHttpStatus outputs the status code and text using http.Error() func RespondHttpStatus(rw http.ResponseWriter, status int) { - http.Error(rw, fmt.Sprintf("%d %s\n", status, http.StatusText(status)), status) + http.Error(rw, fmt.Sprintf("%d %s", status, http.StatusText(status)), status) } func RespondVioletError(rw http.ResponseWriter, status int, msg string) {