Skip to content

Commit

Permalink
Merge branch 'saravanan30erd-issue-71'
Browse files Browse the repository at this point in the history
  • Loading branch information
abutaha committed Jun 5, 2020
2 parents 643e6f4 + 8264122 commit 68ec4a7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,20 @@ export AWS_SECRET_ACCESS_KEY=MY-SECRET-KEY

## Usage example:

You can use either argument `-endpoint` OR environment variable `ENDPOINT` to specify AWS ElasticSearch endpoint.

```sh
./aws-es-proxy -endpoint https://test-es-somerandomvalue.eu-west-1.es.amazonaws.com
Listening on 127.0.0.1:9200
```

```sh
export ENDPOINT=https://test-es-somerandomvalue.eu-west-1.es.amazonaws.com

./aws-es-proxy -listen 10.0.0.1:9200 -verbose
Listening on 10.0.0.1:9200
```

*aws-es-proxy* listens on 127.0.0.1:9200 if no additional argument is provided. You can change the IP and Port passing the argument `-listen`

```sh
Expand Down
14 changes: 10 additions & 4 deletions aws-es-proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,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 68ec4a7

Please sign in to comment.