Skip to content

Commit

Permalink
Go formated
Browse files Browse the repository at this point in the history
  • Loading branch information
Shah Newaz Khan committed Oct 28, 2019
1 parent 489516b commit 8c27716
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
4 changes: 2 additions & 2 deletions cmd/generate.go
Expand Up @@ -21,8 +21,8 @@ var configPath string
var language string

const (
Go = "go"
React = "react"
Go = "go"
React = "react"
Kubernetes = "kubernetes"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/config/config.go
Expand Up @@ -56,13 +56,13 @@ type Commit0Config struct {
Network Network `yaml:"network"`
Services []Service `yaml:"services"`
React React `yaml:"react"`
Kubernetes Kubernetes `yaml:"kubernetes"`
Kubernetes Kubernetes `yaml:"kubernetes"`
}

type Kubernetes struct {
ClusterName string
DNSName string
Deploy bool
DNSName string
Deploy bool
}

func LoadConfig(filePath string) *Commit0Config {
Expand Down
30 changes: 14 additions & 16 deletions internal/generate/kubernetes/generate.go
Expand Up @@ -3,51 +3,49 @@ package kubernetes
import (
"bytes"
"fmt"
"github.com/commitdev/commit0/config"
"github.com/commitdev/commit0/templator"
"io"
"sync"
"log"
"log"
"os"
"os/exec"
"path/filepath"
"github.com/commitdev/commit0/config"
"github.com/commitdev/commit0/templator"
"path/filepath"
"sync"
)

func Generate(templator *templator.Templator, config *config.Commit0Config) {
templator.Kubernetes.TemplateFiles(config, false)


if config.Kubernetes.Deploy {
_tf_init := tf_init()
_tf_plan := tf_plan()
execute(_tf_init)
execute(_tf_plan)
}

}

// Terraform init cmd
func tf_init() *exec.Cmd {
return exec.Command("terraform","init")

return exec.Command("terraform", "init")
}

// Terraform plan cmd
func tf_plan() *exec.Cmd {
return exec.Command("terraform","plan")

return exec.Command("terraform", "plan")
}

// Executes cmd passed in
func execute( cmd *exec.Cmd){
// Executes cmd passed in
func execute(cmd *exec.Cmd) {
dir, err1 := filepath.Abs(filepath.Dir(os.Args[0]))
if err1 != nil {
log.Fatal(err1)
if err1 != nil {
log.Fatal(err1)
}

cmd.Dir = dir + "/kubernetes/terraform"


var errStdout, errStderr error
stdoutIn, _ := cmd.StdoutPipe()
stderrIn, _ := cmd.StderrPipe()
Expand Down

0 comments on commit 8c27716

Please sign in to comment.