Skip to content

Commit

Permalink
fix debug copy
Browse files Browse the repository at this point in the history
  • Loading branch information
foosinn committed Mar 2, 2020
1 parent ae47b74 commit b804b4c
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.1.8

- fix debug copy command

## v0.1.7

- fix typo in environment variable VAULES_YAML => VALUES_YAML
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.13

require (
github.com/google/go-cmp v0.3.1
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a
github.com/joho/godotenv v1.3.0
github.com/kelseyhightower/envconfig v1.4.0
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a h1:zPPuIq2jAWWPTrGt70eK/BSch+gFAGrNzecsoENgu2o=
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
Expand Down
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"time"

"github.com/jinzhu/copier"
"github.com/joho/godotenv"
"github.com/kelseyhightower/envconfig"

Expand Down Expand Up @@ -69,12 +70,17 @@ func main() {

// debug
if cfg.Debug {
debugCfg := *cfg
debugCfg := Config{}
copier.Copy(debugCfg, *cfg)
debugCfg.KubeToken = "***"
for i, val := range debugCfg.Values {
kv := strings.SplitN(val, "=", 2)
debugCfg.Values[i] = fmt.Sprintf("%s=***", kv[0])
}
for i, val := range debugCfg.ValuesString {
kv := strings.SplitN(val, "=", 2)
debugCfg.Values[i] = fmt.Sprintf("%s=***", kv[0])
}
log.Printf("configuration: %+v", debugCfg)
}

Expand Down Expand Up @@ -145,7 +151,7 @@ func runner(ctx context.Context, name string, args ...string) error {
printArgs := make([]string, len(args))
copy(printArgs, args)
for i := 1; i < len(printArgs); i++ {
if printArgs[i-1] == "--set-string" {
if printArgs[i-1] == "--set-string" || printArgs[i-1] == "--set" {
kv := strings.SplitN(printArgs[i], "=", 2)
printArgs[i] = fmt.Sprintf("%s=***", kv[0])
}
Expand Down
3 changes: 3 additions & 0 deletions vendor/github.com/jinzhu/copier/Guardfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/github.com/jinzhu/copier/License

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 100 additions & 0 deletions vendor/github.com/jinzhu/copier/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

189 changes: 189 additions & 0 deletions vendor/github.com/jinzhu/copier/copier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b804b4c

Please sign in to comment.