Merge pull request #9253 from dmcgowan/add-proxy-diff-exports

Add exports to proxy plugin config
This commit is contained in:
Maksym Pavlenko 2023-10-17 15:34:41 -07:00 committed by GitHub
commit 8e62cfcf89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -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

View File

@ -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 {