Skip to content

Commit

Permalink
issue abutaha#71 - add env var support for endpoint argument
Browse files Browse the repository at this point in the history
  • Loading branch information
saravanan30erd committed Jun 2, 2020
1 parent 4306126 commit 81d68ed
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions aws-es-proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,16 @@ func main() {
flag.StringVar(&realm, "realm", "", "Authentication Required")
flag.Parse()

if len(os.Args) < 2 {
fmt.Println("You need to specify Amazon ElasticSearch endpoint.")
fmt.Println("Please run with '-h' for a list of available arguments.")
os.Exit(1)
if endpoint == "" {
if v, ok := os.LookupEnv(strings.ToUpper("endpoint")); ok {
endpoint = v
} else {
text := "You need to specify Amazon ElasticSearch endpoint.\n" +
"You can use either argument '-endpoint' OR environment variable 'ENDPOINT'.\n" +
"Please run with '-h' for a list of available arguments."
fmt.Println(text)
os.Exit(1)
}
}

if debug {
Expand Down

0 comments on commit 81d68ed

Please sign in to comment.