-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Markus Blaschke <[email protected]>
- Loading branch information
Showing
8 changed files
with
112 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package config | ||
|
||
import ( | ||
"encoding/json" | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
type ( | ||
Opts struct { | ||
// logger | ||
Logger struct { | ||
Debug bool ` long:"debug" env:"DEBUG" description:"debug mode"` | ||
Verbose bool `short:"v" long:"verbose" env:"VERBOSE" description:"verbose mode"` | ||
LogJson bool ` long:"log.json" env:"LOG_JSON" description:"Switch log output to json format"` | ||
} | ||
|
||
// elasticsearch | ||
Elasticsearch struct { | ||
// ElasticSearch settings | ||
Addresses []string `long:"elasticsearch.address" env:"ELASTICSEARCH_ADDRESS" delim:" " description:"ElasticSearch urls" required:"true"` | ||
Username string `long:"elasticsearch.username" env:"ELASTICSEARCH_USERNAME" description:"ElasticSearch username for HTTP Basic Authentication"` | ||
Password string `long:"elasticsearch.password" env:"ELASTICSEARCH_PASSWORD" description:"ElasticSearch password for HTTP Basic Authentication" json:"-"` | ||
ApiKey string `long:"elasticsearch.apikey" env:"ELASTICSEARCH_APIKEY" description:"ElasticSearch base64-encoded token for authorization; if set, overrides username and password" json:"-"` | ||
Index string `long:"elasticsearch.index" env:"ELASTICSEARCH_INDEX" description:"ElasticSearch index name (placeholders: %y for year, %m for month and %d for day)" default:"alertmanager-%y.%m"` | ||
} | ||
|
||
// general options | ||
ServerBind string `long:"bind" env:"SERVER_BIND" description:"Server address" default:":8080"` | ||
} | ||
) | ||
|
||
func (o *Opts) GetJson() []byte { | ||
jsonBytes, err := json.Marshal(o) | ||
if err != nil { | ||
log.Panic(err) | ||
} | ||
return jsonBytes | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.