Files
WeKnora/cmd/server/plugin_host.go
T
lyingbug da4ef68d9d feat(plugin): standalone plugin hosts with Redis discovery (P2 batch 4) (#3725)
* feat(plugin): standalone plugin hosts with Redis discovery
2026-09-26 14:46:26 +08:00

31 lines
772 B
Go

package main
import (
"context"
"os"
"os/signal"
"github.com/Tencent/WeKnora/internal/container"
"github.com/Tencent/WeKnora/internal/logger"
)
// runPluginHost is `WeKnora plugin-host`: a standalone plugin host that
// runs host plugins for the app nodes (see container.RunPluginHost).
func runPluginHost() int {
ctx, stop := signal.NotifyContext(context.Background(), shutdownSignals...)
defer stop()
if err := container.RunPluginHost(ctx); err != nil {
logger.Errorf(context.Background(), "[plugin-host] %v", err)
return 1
}
return 0
}
// subcommand runs a subcommand named on the command line, if any.
func subcommand() (code int, ran bool) {
if len(os.Args) > 1 && os.Args[1] == "plugin-host" {
return runPluginHost(), true
}
return 0, false
}