ソースを参照

Added new backend setting for license file

Torkel Ödegaard 7 年 前
コミット
28b0ae1d82
3 ファイル変更17 行追加6 行削除
  1. 4 0
      conf/defaults.ini
  2. 5 0
      conf/sample.ini
  3. 8 6
      pkg/setting/setting.go

+ 4 - 0
conf/defaults.ini

@@ -557,3 +557,7 @@ callback_url =
 
 
 [panels]
 [panels]
 enable_alpha = false
 enable_alpha = false
+
+[enterprise]
+license_path =
+

+ 5 - 0
conf/sample.ini

@@ -475,3 +475,8 @@ log_queries =
 # Options to configure external image rendering server like https://github.com/grafana/grafana-image-renderer
 # Options to configure external image rendering server like https://github.com/grafana/grafana-image-renderer
 ;server_url =
 ;server_url =
 ;callback_url =
 ;callback_url =
+
+[enterprise]
+# Path to a valid Grafana Enterprise license.jwt file
+;license_path =
+

+ 8 - 6
pkg/setting/setting.go

@@ -209,12 +209,10 @@ type Cfg struct {
 	RendererLimitAlerting int
 	RendererLimitAlerting int
 
 
 	DisableBruteForceLoginProtection bool
 	DisableBruteForceLoginProtection bool
-
-	TempDataLifetime time.Duration
-
-	MetricsEndpointEnabled bool
-
-	EnableAlphaPanels bool
+	TempDataLifetime                 time.Duration
+	MetricsEndpointEnabled           bool
+	EnableAlphaPanels                bool
+	EnterpriseLicensePath            string
 }
 }
 
 
 type CommandLineArgs struct {
 type CommandLineArgs struct {
@@ -715,6 +713,10 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
 
 
 	imageUploadingSection := iniFile.Section("external_image_storage")
 	imageUploadingSection := iniFile.Section("external_image_storage")
 	ImageUploadProvider = imageUploadingSection.Key("provider").MustString("")
 	ImageUploadProvider = imageUploadingSection.Key("provider").MustString("")
+
+	enterprise := iniFile.Section("enterprise")
+	cfg.EnterpriseLicensePath = enterprise.Key("license_path").MustString(filepath.Join(cfg.DataPath, "license.jwt"))
+
 	return nil
 	return nil
 }
 }