File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ func main() {
6464 flag .StringVar (& esURL , "esURL" , esURL , "Elasticsearch HTTP URL" )
6565 flag .BoolVar (& showVersion , "version" , false , "Print version number and exit" )
6666 flag .Parse ()
67-
67+
6868 if showVersion {
6969 fmt .Println (versionString )
7070 os .Exit (0 )
@@ -157,6 +157,13 @@ func handler(w http.ResponseWriter, r *http.Request) {
157157 req .Header .Set ("User-Agent" , versionString )
158158 req .Header .Set ("Content-Type" , "application/json" )
159159
160+ esUser := os .Getenv ("ES_USER" )
161+ esPass := os .Getenv ("ES_PASS" )
162+
163+ if len (esUser ) != 0 && len (esPass ) != 0 {
164+ req .SetBasicAuth (esUser , esPass )
165+ }
166+
160167 resp , err := http .DefaultClient .Do (req )
161168 if err != nil {
162169 notificationsErrored .Inc ()
You can’t perform that action at this time.
0 commit comments