-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.go
59 lines (54 loc) · 1.8 KB
/
dashboard.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package dashboard
import (
"embed"
_ "embed"
"go.lumeweb.com/portal-plugin-dashboard/build"
"go.lumeweb.com/portal-plugin-dashboard/internal"
"go.lumeweb.com/portal-plugin-dashboard/internal/api"
pluginConfig "go.lumeweb.com/portal-plugin-dashboard/internal/config"
pluginDb "go.lumeweb.com/portal-plugin-dashboard/internal/db"
"go.lumeweb.com/portal-plugin-dashboard/internal/provider"
pluginService "go.lumeweb.com/portal-plugin-dashboard/internal/service"
"go.lumeweb.com/portal/core"
"go.lumeweb.com/portal/service"
)
//go:embed templates/*
var mailerTemplates embed.FS
func init() {
templates, err := service.MailerTemplatesFromEmbed(&mailerTemplates, "")
if err != nil {
panic(err)
}
core.RegisterPlugin(core.PluginInfo{
ID: internal.PLUGIN_NAME,
Version: build.GetInfo(),
Meta: func(ctx core.Context, builder core.PortalMetaBuilder) error {
pluginCfg := ctx.Config().GetPlugin(internal.PLUGIN_NAME).API.(*pluginConfig.APIConfig)
if pluginCfg.SocialLogin.Enabled {
builder.AddFeatureFlag("social_login", true)
builder.AddPluginMeta(internal.PLUGIN_NAME, "social_providers", provider.EnabledProviders())
}
builder.AddPluginMeta(internal.PLUGIN_NAME, "subdomain", pluginCfg.Subdomain)
builder.AddPluginMeta(internal.PLUGIN_NAME, "themes", pluginCfg.Themes)
return nil
},
API: func() (core.API, []core.ContextBuilderOption, error) {
return api.NewAPI()
},
Services: func() ([]core.ServiceInfo, error) {
return []core.ServiceInfo{
{
ID: pluginService.API_KEY_SERVICE,
Factory: func() (core.Service, []core.ContextBuilderOption, error) {
return pluginService.NewAPIKeyService()
},
Depends: []string{core.USER_SERVICE, core.AUTH_SERVICE},
},
}, nil
},
Models: []any{
&pluginDb.APIKey{},
},
MailerTemplates: templates,
})
}