Skip to content

Commit e4639ad

Browse files
committed
Add exports to proxy plugin config
Allows external plugins to define exports. Signed-off-by: Derek McGowan <[email protected]>
1 parent aef2ebc commit e4639ad

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

services/server/config/config.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,10 @@ type CgroupConfig struct {
235235

236236
// ProxyPlugin provides a proxy plugin configuration
237237
type ProxyPlugin struct {
238-
Type string `toml:"type"`
239-
Address string `toml:"address"`
240-
Platform string `toml:"platform"`
238+
Type string `toml:"type"`
239+
Address string `toml:"address"`
240+
Platform string `toml:"platform"`
241+
Exports map[string]string `toml:"exports"`
241242
}
242243

243244
// Decode unmarshals a plugin specific configuration by plugin id

services/server/server.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,17 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]plugin.Regist
491491
p = platforms.DefaultSpec()
492492
}
493493

494+
exports := pp.Exports
495+
if exports == nil {
496+
exports = map[string]string{}
497+
}
498+
exports["address"] = address
499+
494500
registry.Register(&plugin.Registration{
495501
Type: t,
496502
ID: name,
497503
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
498-
ic.Meta.Exports["address"] = address
504+
ic.Meta.Exports = exports
499505
ic.Meta.Platforms = append(ic.Meta.Platforms, p)
500506
conn, err := clients.getClient(address)
501507
if err != nil {

0 commit comments

Comments
 (0)