Commit cc502407 authored by vicotor's avatar vicotor

update

parent 44421f0d
...@@ -30,7 +30,7 @@ func (c *CaddyAPI) buildPayloadForCreateWebsite(domain string, root string) (str ...@@ -30,7 +30,7 @@ func (c *CaddyAPI) buildPayloadForCreateWebsite(domain string, root string) (str
RootDir: root, RootDir: root,
WebsiteCaddyFile: filepath.Join(c.RootDir, fmt.Sprintf("%s.caddy", domain)), WebsiteCaddyFile: filepath.Join(c.RootDir, fmt.Sprintf("%s.caddy", domain)),
} }
tmpl, err := template.New("test").Parse(staticWebsiteCaddyFileTempl) tmpl, err := template.New("test").Parse(newWebsitePayloadTempl)
if err != nil { if err != nil {
log.WithError(err).Error("failed to parse website caddyfile template") log.WithError(err).Error("failed to parse website caddyfile template")
return "", err return "", err
...@@ -88,6 +88,7 @@ func (c *CaddyAPI) CreateWebsite(domain string, resource string) error { ...@@ -88,6 +88,7 @@ func (c *CaddyAPI) CreateWebsite(domain string, resource string) error {
// send put request to the caddy api. // send put request to the caddy api.
path := fmt.Sprintf("%s/config/apps/http/servers/srv0/routes/%d", c.Url, 0) path := fmt.Sprintf("%s/config/apps/http/servers/srv0/routes/%d", c.Url, 0)
log.WithField("payload", payload).Debug("sending payload to caddy")
if err := c.put(path, []byte(payload)); err != nil { if err := c.put(path, []byte(payload)); err != nil {
return err return err
} }
......
...@@ -33,6 +33,7 @@ func setlog(path string) func() { ...@@ -33,6 +33,7 @@ func setlog(path string) func() {
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
log.SetLevel(log.DebugLevel)
log.SetOutput(file) log.SetOutput(file)
return func() { return func() {
file.Close() file.Close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment