Skip to content

Commit 8fb6bfa

Browse files
dmcgowanKern Walster
authored andcommitted
Add exports to proxy plugin config
Allows external plugins to define exports. Signed-off-by: Derek McGowan <[email protected]> (cherry picked from commit e4639ad) Signed-off-by: Kern Walster <[email protected]>
1 parent 8916e2c commit 8fb6bfa

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
@@ -164,9 +164,10 @@ type CgroupConfig struct {
164164

165165
// ProxyPlugin provides a proxy plugin configuration
166166
type ProxyPlugin struct {
167-
Type string `toml:"type"`
168-
Address string `toml:"address"`
169-
Platform string `toml:"platform"`
167+
Type string `toml:"type"`
168+
Address string `toml:"address"`
169+
Platform string `toml:"platform"`
170+
Exports map[string]string `toml:"exports"`
170171
}
171172

172173
// 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
@@ -490,11 +490,17 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]*plugin.Regis
490490
p = platforms.DefaultSpec()
491491
}
492492

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

0 commit comments

Comments
 (0)