Skip to content

Commit 0767ac8

Browse files
authored
Merge pull request #11 from bugout-dev/secret-param-string
Allow to fetch AWS SSM parameters with decryption
2 parents 1aec180 + 5e8345a commit 0767ac8

4 files changed

Lines changed: 26 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
# vendor/
1616

1717
# Custom
18-
checkenv
18+
checkenv_dev
1919
.secrets/

aws_ssm/parameters.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ func FetchParameters(ctx context.Context, api AWSSystemsManagerParameterStoreAPI
2020

2121
for _, chunk := range chunks {
2222
getInput := &ssm.GetParametersInput{
23-
Names: chunk,
23+
Names: chunk,
24+
WithDecryption: true,
2425
}
2526
results, err := ExecGetParameters(ctx, api, getInput)
2627
if err != nil {

checkenv.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"strings"
99
)
1010

11+
const CHECKENV_VERSION = "v0.0.3"
12+
1113
type showSpec struct {
1214
loadFrom map[string]interface{}
1315
providersFull map[string]interface{}
@@ -68,7 +70,9 @@ func main() {
6870
showRaw := showFlags.Bool("raw", false, "Use this flag to prevent comments output")
6971
showValue := showFlags.Bool("value", false, "Print value only")
7072

71-
availableCommands := fmt.Sprintf("%s,%s", pluginsCommand, showCommand)
73+
versionCommand := "version"
74+
75+
availableCommands := fmt.Sprintf("%s,%s,%s", pluginsCommand, showCommand, versionCommand)
7276

7377
if len(os.Args) < 2 {
7478
fmt.Fprintf(os.Stderr, "Please use one of the subcommands: %s\n", availableCommands)
@@ -139,6 +143,13 @@ func main() {
139143
}
140144
}
141145
}
146+
case versionCommand:
147+
pluginsFlags.Parse(os.Args[2:])
148+
if *pluginsHelp {
149+
fmt.Fprintf(os.Stderr, "Usage: %s %s\nShows version of checkenv.\n", os.Args[0], os.Args[1])
150+
os.Exit(2)
151+
}
152+
fmt.Println(CHECKENV_VERSION)
142153
default:
143154
fmt.Fprintf(os.Stderr, "Unknown command: %s. Please use one of the subcommands: %s.\n", command, availableCommands)
144155
}

dev.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
3+
# Compile application and run with provided arguments
4+
set -e
5+
6+
PROGRAM_NAME="checkenv_dev"
7+
8+
go build -o "$PROGRAM_NAME" .
9+
10+
./"$PROGRAM_NAME" "$@"
11+

0 commit comments

Comments
 (0)