Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added kubescret provider #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aws_ssm.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ func AWSSystemsManagerParameterStoreProvider(filter string) (map[string]string,

func init() {
helpString := "Provides environment variables defined in AWS Systems Manager Parameter Store."
RegisterPlugin("aws_ssm", helpString, noop, AWSSystemsManagerParameterStoreProvider)
RegisterPlugin("aws_ssm", helpString, AWSSystemsManagerParameterStoreProvider)
}
15 changes: 12 additions & 3 deletions checkenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func main() {
showExport := showFlags.Bool("export", false, "Use this flag to prepend and \"export \" before every environment variable definition")
showRaw := showFlags.Bool("raw", false, "Use this flag to prevent comments output")
showValue := showFlags.Bool("value", false, "Print value only")
showName := showFlags.Bool("name", false, "Print name only")

versionCommand := "version"

Expand Down Expand Up @@ -98,12 +99,18 @@ func main() {
fmt.Fprintf(os.Stderr, "Usage: %s %s [<provider_name>[+<provider_args>] ...] [<provider_name>[+<provider_args>]://<var_name_1>,<var_name_2>,...,<var_name_n> ...]\nShows the environment variables defined by the given providers.\n", os.Args[0], os.Args[1])
os.Exit(2)
}

if *showName && *showValue {
fmt.Fprintf(os.Stderr, "You can't use both -name and -value flags at the same time.\n")
os.Exit(1)
}

spec := parseShowSpec(showFlags.Args())
providedVars := make(map[string]map[string]string)
for providerSpec := range spec.loadFrom {
vars, providerErr := VariablesFromProviderSpec(providerSpec)
if providerErr != nil {
log.Fatalf(providerErr.Error())
log.Fatal(providerErr.Error())
}
providedVars[providerSpec] = vars
}
Expand All @@ -118,10 +125,12 @@ func main() {
fmt.Printf("# Generated with %s - all variables:\n", providerSpec)
}
for k, v := range providedVars[providerSpec] {
if !*showValue {
if !*showValue && !*showName {
fmt.Printf("%s%s=%s\n", exportPrefix, k, v)
} else {
} else if *showValue {
fmt.Printf("%s\n", v)
} else if *showName {
fmt.Printf("%s\n", k)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion env.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ func CurrentEnvProvider(filter string) (map[string]string, error) {

func init() {
helpString := "Provides the environment variables defined in the checkenv process."
RegisterPlugin("env", helpString, noop, CurrentEnvProvider)
RegisterPlugin("env", helpString, CurrentEnvProvider)
}
2 changes: 1 addition & 1 deletion envfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ func EnvFileProvider(filter string) (map[string]string, error) {

func init() {
helpString := "Provides the environment variables defined in the env file with the given path."
RegisterPlugin("file", helpString, noop, EnvFileProvider)
RegisterPlugin("file", helpString, EnvFileProvider)
}
60 changes: 58 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,65 @@
module github.com/bugout-dev/checkenv

go 1.16
go 1.22.0

toolchain go1.22.8

require (
github.com/aws/aws-sdk-go-v2 v1.11.2
github.com/aws/aws-sdk-go-v2/config v1.11.0
github.com/aws/aws-sdk-go-v2/service/ssm v1.17.1
k8s.io/client-go v0.31.1
)

require (
github.com/aws/aws-sdk-go-v2 v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.6.4 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.8.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.0.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.5.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.6.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.11.1 // indirect
github.com/aws/smithy-go v1.9.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.31.1 // indirect
k8s.io/apimachinery v0.31.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading