mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Zanzana: Initial work to run openFGA as embedded or standalone service (#89211)
* Zanana: Initial work to run zanana as ebeddedn or standalone * Add addr settings for when remote client is used. * sync dependencies * Lock mysql driver version --------- Co-authored-by: Dan Cech <dcech@grafana.com>
This commit is contained in:
@@ -475,6 +475,8 @@ type Cfg struct {
|
||||
// RBAC single organization. This configuration option is subject to change.
|
||||
RBACSingleOrganization bool
|
||||
|
||||
Zanzana ZanzanaSettings
|
||||
|
||||
// GRPC Server.
|
||||
GRPCServerNetwork string
|
||||
GRPCServerAddress string
|
||||
@@ -1113,6 +1115,9 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error {
|
||||
readOAuth2ServerSettings(cfg)
|
||||
|
||||
readAccessControlSettings(iniFile, cfg)
|
||||
|
||||
cfg.readZanzanaSettings()
|
||||
|
||||
if err := cfg.readRenderingSettings(iniFile); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
37
pkg/setting/settings_zanzana.go
Normal file
37
pkg/setting/settings_zanzana.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package setting
|
||||
|
||||
import (
|
||||
"slices"
|
||||
)
|
||||
|
||||
type ZanzanaMode string
|
||||
|
||||
const (
|
||||
ZanzanaModeClient ZanzanaMode = "client"
|
||||
ZanzanaModeEmbedded ZanzanaMode = "embedded"
|
||||
)
|
||||
|
||||
type ZanzanaSettings struct {
|
||||
// Addr is only used when mode is set to client
|
||||
Addr string
|
||||
// Mode can either be embedded or client
|
||||
Mode ZanzanaMode
|
||||
}
|
||||
|
||||
func (cfg *Cfg) readZanzanaSettings() {
|
||||
s := ZanzanaSettings{}
|
||||
|
||||
sec := cfg.Raw.Section("zanzana")
|
||||
s.Mode = ZanzanaMode(sec.Key("mode").MustString("embedded"))
|
||||
|
||||
validModes := []ZanzanaMode{ZanzanaModeEmbedded, ZanzanaModeClient}
|
||||
|
||||
if !slices.Contains(validModes, s.Mode) {
|
||||
cfg.Logger.Warn("Invalid zanzana mode", "expected", validModes, "got", s.Mode)
|
||||
s.Mode = "embedded"
|
||||
}
|
||||
|
||||
s.Addr = sec.Key("address").MustString("")
|
||||
|
||||
cfg.Zanzana = s
|
||||
}
|
||||
Reference in New Issue
Block a user