mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
datasource as cfg: improve name for this feature
This commit is contained in:
parent
ba4bbd1d47
commit
c9bfa781fd
@ -1,20 +1,41 @@
|
||||
# purge data source not listed in configuration.
|
||||
# not recommended in HA setups if config can
|
||||
# can differ between instances.
|
||||
purge_other_datasources: false
|
||||
|
||||
# list of datasources to insert/update depending
|
||||
# whats available in the datbase
|
||||
datasources:
|
||||
# <string, required> name of the datasource. Required
|
||||
- name: Graphite
|
||||
# <string, required> datasource type. Required
|
||||
type: graphite
|
||||
# <string, required> access mode. direct or proxy. Required
|
||||
access: proxy
|
||||
# <string, required> url
|
||||
url: http://localhost:8080
|
||||
password: #string
|
||||
user: #string
|
||||
database: #string
|
||||
basic_auth: #bool
|
||||
basic_authUser: #string
|
||||
basic_auth_password: #string
|
||||
with_credentials: #bool
|
||||
is_default: true #bool
|
||||
json_data: '{"graphiteVersion":"0.9"}' # string json
|
||||
secure_json_fields: '' #string json
|
||||
# <string> database password, if used
|
||||
password:
|
||||
# <string> database user, if used
|
||||
user:
|
||||
# <string> database name, if used
|
||||
database:
|
||||
# <bool> enable/disable basic auth
|
||||
basic_auth:
|
||||
# <string> basic auth username
|
||||
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
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://localhost:9090
|
||||
|
||||
|
@ -23,7 +23,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/search"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"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/tracing"
|
||||
)
|
||||
@ -56,9 +56,9 @@ func (g *GrafanaServerImpl) Start() {
|
||||
g.writePIDFile()
|
||||
|
||||
initSql()
|
||||
err := dsSettings.Init(filepath.Join(setting.HomePath, "conf/datasources.yaml"))
|
||||
err := datasourcesFromConfig.Apply(filepath.Join(setting.HomePath, "conf/datasources.yaml"))
|
||||
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")
|
||||
return
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ var (
|
||||
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()
|
||||
return dc.applyChanges(configPath)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user