Commit c9bfa781 by bergquist

datasource as cfg: improve name for this feature

parent ba4bbd1d
# purge data source not listed in configuration.
# not recommended in HA setups if config can
# can differ between instances.
purge_other_datasources: false purge_other_datasources: false
# list of datasources to insert/update depending
# whats available in the datbase
datasources: datasources:
# <string, required> name of the datasource. Required
- name: Graphite - name: Graphite
# <string, required> datasource type. Required
type: graphite type: graphite
# <string, required> access mode. direct or proxy. Required
access: proxy access: proxy
# <string, required> url
url: http://localhost:8080 url: http://localhost:8080
password: #string # <string> database password, if used
user: #string password:
database: #string # <string> database user, if used
basic_auth: #bool user:
basic_authUser: #string # <string> database name, if used
basic_auth_password: #string database:
with_credentials: #bool # <bool> enable/disable basic auth
is_default: true #bool basic_auth:
json_data: '{"graphiteVersion":"0.9"}' # string json # <string> basic auth username
secure_json_fields: '' #string json basic_authUser:
# <string> basic auth password
basic_auth_password:
# <bool> enable/disable with credentials headers
with_credentials:
# <bool> mark as default datasource. Max one per org
is_default:
# <string> json data
json_data: '{"graphiteVersion":"0.9"}'
# <string> json object of data that will be encrypted in UI.
secure_json_fields: ''
- name: Prometheus - name: Prometheus
type: prometheus type: prometheus
access: proxy access: proxy
url: http://localhost:9090 url: http://localhost:9090
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,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"
dsSettings "github.com/grafana/grafana/pkg/setting/datasources" 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,9 +56,9 @@ func (g *GrafanaServerImpl) Start() { ...@@ -56,9 +56,9 @@ func (g *GrafanaServerImpl) Start() {
g.writePIDFile() g.writePIDFile()
initSql() initSql()
err := dsSettings.Init(filepath.Join(setting.HomePath, "conf/datasources.yaml")) err := datasourcesFromConfig.Apply(filepath.Join(setting.HomePath, "conf/datasources.yaml"))
if err != nil { if err != nil {
g.log.Error("Failed to load datasources from config", "error", err) g.log.Error("Failed to configure datasources from config", "error", err)
g.Shutdown(1, "Startup failed") g.Shutdown(1, "Startup failed")
return return
} }
......
...@@ -16,7 +16,7 @@ var ( ...@@ -16,7 +16,7 @@ var (
ErrInvalidConfigToManyDefault = errors.New("datasource.yaml config is invalid. Only one datasource can be marked as default") ErrInvalidConfigToManyDefault = errors.New("datasource.yaml config is invalid. Only one datasource can be marked as default")
) )
func Init(configPath string) error { func Apply(configPath string) error {
dc := NewDatasourceConfiguration() dc := NewDatasourceConfiguration()
return dc.applyChanges(configPath) return dc.applyChanges(configPath)
} }
......
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