Live: Allow setting the engine password (#76289)
This commit is contained in:
@@ -1525,6 +1525,9 @@ ha_engine =
|
|||||||
# This option is EXPERIMENTAL.
|
# This option is EXPERIMENTAL.
|
||||||
ha_engine_address = "127.0.0.1:6379"
|
ha_engine_address = "127.0.0.1:6379"
|
||||||
|
|
||||||
|
# ha_engine_password allows setting an optional password to authenticate with the engine
|
||||||
|
ha_engine_password = ""
|
||||||
|
|
||||||
#################################### Grafana Image Renderer Plugin ##########################
|
#################################### Grafana Image Renderer Plugin ##########################
|
||||||
[plugin.grafana-image-renderer]
|
[plugin.grafana-image-renderer]
|
||||||
# Instruct headless browser instance to use a default timezone when not provided by Grafana, e.g. when rendering panel image of alert.
|
# Instruct headless browser instance to use a default timezone when not provided by Grafana, e.g. when rendering panel image of alert.
|
||||||
|
|||||||
@@ -1418,6 +1418,9 @@
|
|||||||
# This option is EXPERIMENTAL.
|
# This option is EXPERIMENTAL.
|
||||||
;ha_engine_address = "127.0.0.1:6379"
|
;ha_engine_address = "127.0.0.1:6379"
|
||||||
|
|
||||||
|
# ha_engine_password allows setting an optional password to authenticate with the engine
|
||||||
|
;ha_engine_password = ""
|
||||||
|
|
||||||
#################################### Grafana Image Renderer Plugin ##########################
|
#################################### Grafana Image Renderer Plugin ##########################
|
||||||
[plugin.grafana-image-renderer]
|
[plugin.grafana-image-renderer]
|
||||||
# Instruct headless browser instance to use a default timezone when not provided by Grafana, e.g. when rendering panel image of alert.
|
# Instruct headless browser instance to use a default timezone when not provided by Grafana, e.g. when rendering panel image of alert.
|
||||||
|
|||||||
@@ -124,8 +124,9 @@ func ProvideService(plugCtxProvider *plugincontext.Provider, cfg *setting.Cfg, r
|
|||||||
// will be connected over Redis PUB/SUB. Presence will work
|
// will be connected over Redis PUB/SUB. Presence will work
|
||||||
// globally since kept inside Redis.
|
// globally since kept inside Redis.
|
||||||
redisAddress := g.Cfg.LiveHAEngineAddress
|
redisAddress := g.Cfg.LiveHAEngineAddress
|
||||||
|
redisPassword := g.Cfg.LiveHAEnginePassword
|
||||||
redisShardConfigs := []centrifuge.RedisShardConfig{
|
redisShardConfigs := []centrifuge.RedisShardConfig{
|
||||||
{Address: redisAddress},
|
{Address: redisAddress, Password: redisPassword},
|
||||||
}
|
}
|
||||||
var redisShards []*centrifuge.RedisShard
|
var redisShards []*centrifuge.RedisShard
|
||||||
for _, redisConf := range redisShardConfigs {
|
for _, redisConf := range redisShardConfigs {
|
||||||
@@ -160,7 +161,8 @@ func ProvideService(plugCtxProvider *plugincontext.Provider, cfg *setting.Cfg, r
|
|||||||
var managedStreamRunner *managedstream.Runner
|
var managedStreamRunner *managedstream.Runner
|
||||||
if g.IsHA() {
|
if g.IsHA() {
|
||||||
redisClient := redis.NewClient(&redis.Options{
|
redisClient := redis.NewClient(&redis.Options{
|
||||||
Addr: g.Cfg.LiveHAEngineAddress,
|
Addr: g.Cfg.LiveHAEngineAddress,
|
||||||
|
Password: g.Cfg.LiveHAEnginePassword,
|
||||||
})
|
})
|
||||||
cmd := redisClient.Ping(context.Background())
|
cmd := redisClient.Ping(context.Background())
|
||||||
if _, err := cmd.Result(); err != nil {
|
if _, err := cmd.Result(); err != nil {
|
||||||
|
|||||||
@@ -482,7 +482,8 @@ type Cfg struct {
|
|||||||
// Zero value means in-memory single node setup.
|
// Zero value means in-memory single node setup.
|
||||||
LiveHAEngine string
|
LiveHAEngine string
|
||||||
// LiveHAEngineAddress is a connection address for Live HA engine.
|
// LiveHAEngineAddress is a connection address for Live HA engine.
|
||||||
LiveHAEngineAddress string
|
LiveHAEngineAddress string
|
||||||
|
LiveHAEnginePassword string
|
||||||
// LiveAllowedOrigins is a set of origins accepted by Live. If not provided
|
// LiveAllowedOrigins is a set of origins accepted by Live. If not provided
|
||||||
// then Live uses AppURL as the only allowed origin.
|
// then Live uses AppURL as the only allowed origin.
|
||||||
LiveAllowedOrigins []string
|
LiveAllowedOrigins []string
|
||||||
@@ -1989,6 +1990,7 @@ func (cfg *Cfg) readLiveSettings(iniFile *ini.File) error {
|
|||||||
return fmt.Errorf("unsupported live HA engine type: %s", cfg.LiveHAEngine)
|
return fmt.Errorf("unsupported live HA engine type: %s", cfg.LiveHAEngine)
|
||||||
}
|
}
|
||||||
cfg.LiveHAEngineAddress = section.Key("ha_engine_address").MustString("127.0.0.1:6379")
|
cfg.LiveHAEngineAddress = section.Key("ha_engine_address").MustString("127.0.0.1:6379")
|
||||||
|
cfg.LiveHAEnginePassword = section.Key("ha_engine_password").MustString("")
|
||||||
|
|
||||||
var originPatterns []string
|
var originPatterns []string
|
||||||
allowedOrigins := section.Key("allowed_origins").MustString("")
|
allowedOrigins := section.Key("allowed_origins").MustString("")
|
||||||
|
|||||||
Reference in New Issue
Block a user