From e4639ad18bb8676de979091e88905505f307e53e Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Mon, 16 Oct 2023 21:25:57 -0700 Subject: [PATCH] Add exports to proxy plugin config Allows external plugins to define exports. Signed-off-by: Derek McGowan --- services/server/config/config.go | 7 ++++--- services/server/server.go | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/services/server/config/config.go b/services/server/config/config.go index 5c628912d..50f3f07df 100644 --- a/services/server/config/config.go +++ b/services/server/config/config.go @@ -235,9 +235,10 @@ type CgroupConfig struct { // ProxyPlugin provides a proxy plugin configuration type ProxyPlugin struct { - Type string `toml:"type"` - Address string `toml:"address"` - Platform string `toml:"platform"` + Type string `toml:"type"` + Address string `toml:"address"` + Platform string `toml:"platform"` + Exports map[string]string `toml:"exports"` } // Decode unmarshals a plugin specific configuration by plugin id diff --git a/services/server/server.go b/services/server/server.go index 5b42a7172..5e63f3902 100644 --- a/services/server/server.go +++ b/services/server/server.go @@ -491,11 +491,17 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]plugin.Regist p = platforms.DefaultSpec() } + exports := pp.Exports + if exports == nil { + exports = map[string]string{} + } + exports["address"] = address + registry.Register(&plugin.Registration{ Type: t, ID: name, InitFn: func(ic *plugin.InitContext) (interface{}, error) { - ic.Meta.Exports["address"] = address + ic.Meta.Exports = exports ic.Meta.Platforms = append(ic.Meta.Platforms, p) conn, err := clients.getClient(address) if err != nil {