forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
licensing.go
44 lines (36 loc) · 845 Bytes
/
licensing.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package licensing
import (
"fmt"
"github.com/grafana/grafana/pkg/services/licensing"
"github.com/grafana/grafana/pkg/setting"
)
type Service struct {
licensePath string
appURL string
license licensing.Licensing
}
func ProvideLicensing(cfg *setting.Cfg, l licensing.Licensing) *Service {
return &Service{
licensePath: cfg.EnterpriseLicensePath,
appURL: cfg.AppURL,
license: l,
}
}
func (l Service) Environment() []string {
var env []string
if envProvider, ok := l.license.(licensing.LicenseEnvironment); ok {
for k, v := range envProvider.Environment() {
env = append(env, fmt.Sprintf("%s=%s", k, v))
}
}
return env
}
func (l Service) Edition() string {
return l.license.Edition()
}
func (l Service) Path() string {
return l.licensePath
}
func (l Service) AppURL() string {
return l.appURL
}