Commit 665df676 by bergquist

datasource as cfg: rename feature to provisioning

parent c9bfa781
...@@ -9,6 +9,9 @@ import ( ...@@ -9,6 +9,9 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
"github.com/grafana/grafana/pkg/services/provisioning"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"github.com/grafana/grafana/pkg/api" "github.com/grafana/grafana/pkg/api"
...@@ -23,7 +26,7 @@ import ( ...@@ -23,7 +26,7 @@ import (
"github.com/grafana/grafana/pkg/services/search" "github.com/grafana/grafana/pkg/services/search"
"github.com/grafana/grafana/pkg/services/sqlstore" "github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
datasourcesFromConfig "github.com/grafana/grafana/pkg/setting/datasources"
"github.com/grafana/grafana/pkg/social" "github.com/grafana/grafana/pkg/social"
"github.com/grafana/grafana/pkg/tracing" "github.com/grafana/grafana/pkg/tracing"
) )
...@@ -56,18 +59,19 @@ func (g *GrafanaServerImpl) Start() { ...@@ -56,18 +59,19 @@ func (g *GrafanaServerImpl) Start() {
g.writePIDFile() g.writePIDFile()
initSql() initSql()
err := datasourcesFromConfig.Apply(filepath.Join(setting.HomePath, "conf/datasources.yaml"))
if err != nil {
g.log.Error("Failed to configure datasources from config", "error", err)
g.Shutdown(1, "Startup failed")
return
}
metrics.Init(setting.Cfg) metrics.Init(setting.Cfg)
search.Init() search.Init()
login.Init() login.Init()
social.NewOAuthService() social.NewOAuthService()
plugins.Init() plugins.Init()
if err := provisioning.StartUp(setting.HomePath); err != nil {
logger.Error("Failed to provision Grafana from config", "error", err)
g.Shutdown(1, "Startup failed")
return
}
closer, err := tracing.Init(setting.Cfg) closer, err := tracing.Init(setting.Cfg)
if err != nil { if err != nil {
g.log.Error("Tracing settings is not valid", "error", err) g.log.Error("Tracing settings is not valid", "error", err)
......
package provisioning
import (
"path/filepath"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/services/provisioning/datasources"
)
var (
logger log.Logger = log.New("services.provisioning")
)
func StartUp(homePath string) error {
return datasources.Apply(filepath.Join(homePath, "conf/datasources.yaml"))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment