Skip to content

Commit

Permalink
Merge pull request #16 from dung13890/develop
Browse files Browse the repository at this point in the history
refs #fix bug generate from file
  • Loading branch information
dung13890 authored Feb 25, 2021
2 parents bb0fea8 + 92ea53a commit d0eb819
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"github.com/AlecAivazis/survey/v2"
"github.com/dung13890/deploy-tool/config"
"github.com/fatih/color"
"github.com/urfave/cli/v2"
"log"
Expand Down Expand Up @@ -91,11 +92,11 @@ func (a *answers) createFile(filename string) (err error) {
return
}
// Parse template to template yml
t, err := template.ParseFiles(filepath.Join(dir, "templates", "config.tmpl"))
t, err := template.New("index").Parse(config.SourceYaml)
if err != nil {
return
}
t.ExecuteTemplate(f, "config", a)
t.Execute(f, a)

return nil
}
30 changes: 30 additions & 0 deletions config/yml.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package config

var SourceYaml = `server:
address: "{{ .Ip }}"
user: "ec2-user"
port: 22
dir: "/data/sites"
project: "{{ .Project }}"
repository:
url: "{{ .Repo }}"
branch: "master"
# tag: "1.0.2"
shared:
folders:
- "vendor"
- "node_modules"
files:
- ".env"
tasks:
- "echo 'Hello!!'"
cluster:
hosts:
# - "127.0.0.1"
rsync:
excludes:
- ".env"
- "*.log"
cmds:
- "uname -a"
`

0 comments on commit d0eb819

Please sign in to comment.