Skip to content

Commit

Permalink
Merge pull request #11 from bugout-dev/secret-param-string
Browse files Browse the repository at this point in the history
Allow to fetch AWS SSM parameters with decryption
  • Loading branch information
kompotkot authored Aug 23, 2022
2 parents 1aec180 + 5e8345a commit 0767ac8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
# vendor/

# Custom
checkenv
checkenv_dev
.secrets/
3 changes: 2 additions & 1 deletion aws_ssm/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ func FetchParameters(ctx context.Context, api AWSSystemsManagerParameterStoreAPI

for _, chunk := range chunks {
getInput := &ssm.GetParametersInput{
Names: chunk,
Names: chunk,
WithDecryption: true,
}
results, err := ExecGetParameters(ctx, api, getInput)
if err != nil {
Expand Down
13 changes: 12 additions & 1 deletion checkenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"strings"
)

const CHECKENV_VERSION = "v0.0.3"

type showSpec struct {
loadFrom map[string]interface{}
providersFull map[string]interface{}
Expand Down Expand Up @@ -68,7 +70,9 @@ func main() {
showRaw := showFlags.Bool("raw", false, "Use this flag to prevent comments output")
showValue := showFlags.Bool("value", false, "Print value only")

availableCommands := fmt.Sprintf("%s,%s", pluginsCommand, showCommand)
versionCommand := "version"

availableCommands := fmt.Sprintf("%s,%s,%s", pluginsCommand, showCommand, versionCommand)

if len(os.Args) < 2 {
fmt.Fprintf(os.Stderr, "Please use one of the subcommands: %s\n", availableCommands)
Expand Down Expand Up @@ -139,6 +143,13 @@ func main() {
}
}
}
case versionCommand:
pluginsFlags.Parse(os.Args[2:])
if *pluginsHelp {
fmt.Fprintf(os.Stderr, "Usage: %s %s\nShows version of checkenv.\n", os.Args[0], os.Args[1])
os.Exit(2)
}
fmt.Println(CHECKENV_VERSION)
default:
fmt.Fprintf(os.Stderr, "Unknown command: %s. Please use one of the subcommands: %s.\n", command, availableCommands)
}
Expand Down
11 changes: 11 additions & 0 deletions dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh

# Compile application and run with provided arguments
set -e

PROGRAM_NAME="checkenv_dev"

go build -o "$PROGRAM_NAME" .

./"$PROGRAM_NAME" "$@"

0 comments on commit 0767ac8

Please sign in to comment.