-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathmain.go
More file actions
38 lines (33 loc) · 782 Bytes
/
main.go
File metadata and controls
38 lines (33 loc) · 782 Bytes
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
package main
import (
"context"
"github.com/OpenFunction/functions-framework-go/framework"
"github.com/OpenFunction/functions-framework-go/plugin"
"k8s.io/klog/v2"
"main.go/userfunction"
pluginCustom "main.go/userfunction/plugins/plugin-custom"
)
func main() {
ctx := context.Background()
fwk, err := framework.NewFramework()
if err != nil {
klog.Exit(err)
}
fwk.RegisterPlugins(getLocalPlugins())
if err := fwk.Register(ctx, userfunction.HelloWorld); err != nil {
klog.Exit(err)
}
if err := fwk.Start(ctx); err != nil {
klog.Exit(err)
}
}
func getLocalPlugins() map[string]plugin.Plugin {
localPlugins := map[string]plugin.Plugin{
pluginCustom.Name: pluginCustom.New(),
}
if len(localPlugins) == 0 {
return nil
} else {
return localPlugins
}
}