Skip to content

Commit

Permalink
Merge pull request #190 from kool-dev/kool_deploy
Browse files Browse the repository at this point in the history
Adding new fields to kool deploy
danielsuguimoto authored Oct 30, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents cb45959 + 05a05f0 commit f558281
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions api/deploy.go
Original file line number Diff line number Diff line change
@@ -35,12 +35,14 @@ func (d *Deploy) GetID() string {
// SendFile calls deploy/create in the Kool Dev API
func (d *Deploy) SendFile() (err error) {
var (
buff bytes.Buffer
file *os.File
fw io.Writer
domain string
resp *http.Response
raw []byte
buff bytes.Buffer
file *os.File
fw io.Writer
domain string
domainExtras string
wwwRedirect string
resp *http.Response
raw []byte
)

w := multipart.NewWriter(&buff)
@@ -62,11 +64,25 @@ func (d *Deploy) SendFile() (err error) {
}

defer file.Close()

if domain = environment.NewEnvStorage().Get("KOOL_DEPLOY_DOMAIN"); domain != "" {
if err = w.WriteField("domain", domain); err != nil {
return
}
}

if domainExtras = environment.NewEnvStorage().Get("KOOL_DEPLOY_DOMAIN_EXTRAS"); domainExtras != "" {
if err = w.WriteField("domain_extras", domainExtras); err != nil {
return
}
}

if wwwRedirect = environment.NewEnvStorage().Get("KOOL_DEPLOY_WWW_REDIRECT"); wwwRedirect != "" {
if err = w.WriteField("www_redirect", wwwRedirect); err != nil {
return
}
}

w.Close()

req, _ := http.NewRequest("POST", apiBaseURL+"/deploy/create", &buff)

0 comments on commit f558281

Please sign in to comment.