Licensing: Send map of environment variables to plugins (#30347)

Replace hard-coded `GF_ENTERPRISE_LICENSE_TEXT` with a
`map[string]string` to allow the licensing service to allow sending any
environment variable through to the plugins for licensing purposes.
This commit is contained in:
Emil Tullstedt
2021-01-18 14:42:39 +01:00
committed by GitHub
parent a246a26a2f
commit af27dd7e7d
4 changed files with 12 additions and 8 deletions
+6 -1
View File
@@ -98,8 +98,13 @@ func (m *manager) Register(pluginID string, factory PluginFactoryFunc) error {
hostEnv = append(
hostEnv,
fmt.Sprintf("GF_ENTERPRISE_LICENSE_PATH=%s", m.Cfg.EnterpriseLicensePath),
fmt.Sprintf("GF_ENTERPRISE_LICENSE_TEXT=%s", m.License.TokenRaw()),
)
if envProvider, ok := m.License.(models.LicenseEnvironment); ok {
for k, v := range envProvider.Environment() {
hostEnv = append(hostEnv, fmt.Sprintf("%s=%s", k, v))
}
}
}
env := pluginSettings.ToEnv("GF_PLUGIN", hostEnv)