Skip to content

Commit

Permalink
Merge pull request #433 from daixiang0/fix-logcli
Browse files Browse the repository at this point in the history
remove logcli config part
  • Loading branch information
davkal authored Apr 8, 2019
2 parents d75212d + f634f53 commit 8b8945d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 42 deletions.
20 changes: 0 additions & 20 deletions cmd/logcli/config.go

This file was deleted.

5 changes: 0 additions & 5 deletions cmd/logcli/logcli-config.yaml

This file was deleted.

17 changes: 3 additions & 14 deletions cmd/logcli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
var (
app = kingpin.New("logcli", "A command-line for loki.")

config = app.Flag("config", "Logcli config.").Default("").String()

addr, username, password *string
addr = app.Flag("addr", "Server address.").Default("https://logs-us-west1.grafana.net").Envar("GRAFANA_ADDR").String()
username = app.Flag("username", "Username for HTTP basic auth.").Default("").Envar("GRAFANA_USERNAME").String()
password = app.Flag("password", "Password for HTTP basic auth.").Default("").Envar("GRAFANA_PASSWORD").String()

queryCmd = app.Command("query", "Run a LogQL query.")
queryStr = queryCmd.Arg("query", "eg '{foo=\"bar\",baz=\"blip\"}'").Required().String()
Expand All @@ -28,17 +28,6 @@ var (
)

func main() {
// get val from config file
cfg, err := getConfig(*config)
if err != nil {
fmt.Println(err)
os.Exit(1)
}

addr = app.Flag("addr", "Server address.").Default(cfg.Addr).Envar("GRAFANA_ADDR").String()
username = app.Flag("username", "Username for HTTP basic auth.").Default(cfg.Username).Envar("GRAFANA_USERNAME").String()
password = app.Flag("password", "Password for HTTP basic auth.").Default(cfg.Password).Envar("GRAFANA_PASSWORD").String()

switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case queryCmd.FullCommand():
if *addr == "" {
Expand Down
3 changes: 0 additions & 3 deletions docs/logcli.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ Common labels: {job="cortex-ops/consul", namespace="cortex-ops"}

### Configuration

You may use `--config=path/to/file` to load configuration options from a file. For an example file see `cmd/logcli/logcli-config.yaml`

Configuration values are considered in the following order (lowest to highest):
- config file
- environment value
- command line

Expand All @@ -66,7 +64,6 @@ Flags:
--addr="" Server address, need to specify.
--username="" Username for HTTP basic auth.
--password="" Password for HTTP basic auth.
--config="" Configuration file for logcli.
Commands:
help [<command>...]
Expand Down

0 comments on commit 8b8945d

Please sign in to comment.