Skip to content

Commit 0b8fb0f

Browse files
committed
Added plugins
1 parent b22cd29 commit 0b8fb0f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmd/server/service.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
"fmt"
56
"net/http"
67

78
// Packages
@@ -32,7 +33,8 @@ type ServiceCommands struct {
3233
}
3334

3435
type ServiceRunCommand struct {
35-
Router struct {
36+
Plugins []string `help:"Plugin paths"`
37+
Router struct {
3638
httprouter.Config `embed:"" prefix:"router."` // Router configuration
3739
} `embed:""`
3840
Server struct {
@@ -62,6 +64,15 @@ type ServiceRunCommand struct {
6264
// PUBLIC METHODS
6365

6466
func (cmd *ServiceRunCommand) Run(app server.Cmd) error {
67+
// Load plugins
68+
plugins, err := provider.LoadPluginsForPattern(cmd.Plugins...)
69+
if err != nil {
70+
return err
71+
}
72+
for _, plugin := range plugins {
73+
fmt.Println("TODO: Loaded plugins:", plugin.Name())
74+
}
75+
6576
// Set the server listener and router prefix
6677
cmd.Server.Listen = app.GetEndpoint()
6778
cmd.Router.Prefix = types.NormalisePath(cmd.Server.Listen.Path)

0 commit comments

Comments
 (0)