-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
628 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,3 @@ var CmdImage = cli.Command{ | |
&image.CmdDockerBuild, | ||
}, | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/paramah/ledo/app/cmd/secrets" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var CmdSecrets = cli.Command{ | ||
Name: "secrets", | ||
Aliases: []string{"s"}, | ||
Category: catHelpers, | ||
Usage: "secrets helper", | ||
Description: `Managing secrets with hashicorp vault. | ||
Requires a vault server with a KV2 resource prefixed /environment to function properly. | ||
The vault path is created from project namespace, project name and selected mode. | ||
`, | ||
Subcommands: []*cli.Command{ | ||
&secrets.CmdSecretsRead, | ||
&secrets.CmdSecretsWrite, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package secrets | ||
|
||
import ( | ||
"github.com/paramah/ledo/app/modules/context" | ||
"github.com/paramah/ledo/app/modules/secrets" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var CmdSecretsRead = cli.Command{ | ||
Name: "read", | ||
Aliases: []string{"r"}, | ||
Usage: "read secrets", | ||
Description: `Read secrets from vault`, | ||
Action: RunSecretsRead, | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "addr", | ||
Aliases: []string{"a"}, | ||
Usage: "vault address", | ||
Required: true, | ||
EnvVars: []string{"VAULT_ADDR"}, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "token", | ||
Aliases: []string{"t"}, | ||
Usage: "vault token", | ||
Required: true, | ||
EnvVars: []string{"VAULT_TOKEN"}, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "debug", | ||
Aliases: []string{"d"}, | ||
Usage: "Debug output", | ||
Value: false, | ||
}, | ||
}, | ||
} | ||
|
||
func RunSecretsRead(cmd *cli.Context) error { | ||
ctx := context.InitCommand(cmd) | ||
envs := secrets.SecretRead(ctx, cmd) | ||
secrets.ParseVaultOutput(envs) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package secrets | ||
|
||
import ( | ||
"github.com/paramah/ledo/app/modules/context" | ||
"github.com/paramah/ledo/app/modules/secrets" | ||
"github.com/urfave/cli/v2" | ||
) | ||
|
||
var CmdSecretsWrite = cli.Command{ | ||
Name: "write", | ||
Aliases: []string{"w"}, | ||
Usage: "write secrets", | ||
Description: `Write secrets to vault`, | ||
Action: RunSecretsWrite, | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "addr", | ||
Aliases: []string{"a"}, | ||
Usage: "vault address", | ||
Required: true, | ||
EnvVars: []string{"VAULT_ADDR"}, | ||
}, | ||
&cli.StringFlag{ | ||
Name: "token", | ||
Aliases: []string{"t"}, | ||
Usage: "vault token", | ||
Required: true, | ||
EnvVars: []string{"VAULT_TOKEN"}, | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "debug", | ||
Aliases: []string{"d"}, | ||
Usage: "Debug output", | ||
Value: false, | ||
}, | ||
&cli.PathFlag{ | ||
Name: "input", | ||
Aliases: []string{"i"}, | ||
Usage: "read env from file", | ||
Required: false, | ||
}, | ||
}, | ||
} | ||
|
||
func RunSecretsWrite(cmd *cli.Context) error { | ||
ctx := context.InitCommand(cmd) | ||
secrets.SecretWrite(ctx, cmd) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.