File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,11 @@ package main
3
3
import (
4
4
"os"
5
5
6
- vh "github.com/otaviof/vault-handler/pkg/vault-handler"
7
6
log "github.com/sirupsen/logrus"
8
7
"github.com/spf13/cobra"
9
8
"github.com/spf13/viper"
9
+
10
+ vh "github.com/otaviof/vault-handler/pkg/vault-handler"
10
11
)
11
12
12
13
var downloadCmd = & cobra.Command {
@@ -39,6 +40,7 @@ func init() {
39
40
flags := downloadCmd .PersistentFlags ()
40
41
41
42
flags .String ("output-dir" , "." , "Output directory." )
43
+ flags .Bool ("dot-env" , false , "Create a dot-env file with downloaded secrets" )
42
44
43
45
rootCmd .AddCommand (downloadCmd )
44
46
Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ import (
4
4
"os"
5
5
"strings"
6
6
7
- vh "github.com/otaviof/vault-handler/pkg/vault-handler"
8
7
log "github.com/sirupsen/logrus"
9
8
"github.com/spf13/cobra"
10
9
"github.com/spf13/viper"
10
+
11
+ vh "github.com/otaviof/vault-handler/pkg/vault-handler"
11
12
)
12
13
13
14
var rootCmd = & cobra.Command {
@@ -65,6 +66,7 @@ func configFromEnv() *vh.Config {
65
66
return & vh.Config {
66
67
DryRun : viper .GetBool ("dry-run" ),
67
68
OutputDir : viper .GetString ("output-dir" ),
69
+ DotEnv : viper .GetBool ("dot-env" ),
68
70
InputDir : viper .GetString ("input-dir" ),
69
71
VaultAddr : viper .GetString ("vault-addr" ),
70
72
VaultToken : viper .GetString ("vault-token" ),
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ type Config struct {
9
9
DryRun bool // dry-run flag
10
10
OutputDir string // output directory path
11
11
InputDir string // input directory, when uploading
12
+ DotEnv bool // create a dot-env file with secrets
12
13
VaultAddr string // vault api endpoint
13
14
VaultToken string // vault token
14
15
VaultRoleID string // vault approle role-id
@@ -47,7 +48,7 @@ func (c *Config) ValidateKubernetes() error {
47
48
if c .Namespace == "" {
48
49
return fmt .Errorf ("namespace is not informed" )
49
50
}
50
- if c .KubeConfig != "" && ! fileExists (c .KubeConfig ) {
51
+ if c .KubeConfig != "" && ! FileExists (c .KubeConfig ) {
51
52
return fmt .Errorf ("can't find kube-config file at '%s'" , c .KubeConfig )
52
53
}
53
54
return nil
You can’t perform that action at this time.
0 commit comments