CLI: Fix config flag being ignored

Passing --config had no effect when passed.  It will now be applied as
the last config file and before any env var overrrides.
This commit is contained in:
Jason Wilder
2015-02-15 15:06:02 -07:00
parent 9223c95481
commit b6428b08d0
8 changed files with 31 additions and 38 deletions
+4 -14
View File
@@ -6,8 +6,6 @@ import (
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/log"
m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting"
"os"
"text/tabwriter"
)
@@ -69,9 +67,7 @@ var (
)
func createDataSource(c *cli.Context) {
setting.NewConfigContext()
sqlstore.NewEngine()
sqlstore.EnsureAdminUser()
initRuntime(c)
if len(c.Args()) != 3 {
log.ConsoleFatal("Missing required arguments")
@@ -131,9 +127,7 @@ func createDataSource(c *cli.Context) {
}
func listDatasources(c *cli.Context) {
setting.NewConfigContext()
sqlstore.NewEngine()
sqlstore.EnsureAdminUser()
initRuntime(c)
if !c.Args().Present() {
log.ConsoleFatal("Account name arg is required")
@@ -163,9 +157,7 @@ func listDatasources(c *cli.Context) {
}
func describeDataSource(c *cli.Context) {
setting.NewConfigContext()
sqlstore.NewEngine()
sqlstore.EnsureAdminUser()
initRuntime(c)
if len(c.Args()) != 2 {
log.ConsoleFatal("Account and datasource name args are required")
@@ -206,9 +198,7 @@ func describeDataSource(c *cli.Context) {
}
func deleteDataSource(c *cli.Context) {
setting.NewConfigContext()
sqlstore.NewEngine()
sqlstore.EnsureAdminUser()
initRuntime(c)
if len(c.Args()) != 2 {
log.ConsoleFatal("Account and datasource name args are required")