Add exports to proxy plugin config
Allows external plugins to define exports. Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
parent
aef2ebc76a
commit
e4639ad18b
@ -238,6 +238,7 @@ type ProxyPlugin struct {
|
|||||||
Type string `toml:"type"`
|
Type string `toml:"type"`
|
||||||
Address string `toml:"address"`
|
Address string `toml:"address"`
|
||||||
Platform string `toml:"platform"`
|
Platform string `toml:"platform"`
|
||||||
|
Exports map[string]string `toml:"exports"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode unmarshals a plugin specific configuration by plugin id
|
// Decode unmarshals a plugin specific configuration by plugin id
|
||||||
|
@ -491,11 +491,17 @@ func LoadPlugins(ctx context.Context, config *srvconfig.Config) ([]plugin.Regist
|
|||||||
p = platforms.DefaultSpec()
|
p = platforms.DefaultSpec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports := pp.Exports
|
||||||
|
if exports == nil {
|
||||||
|
exports = map[string]string{}
|
||||||
|
}
|
||||||
|
exports["address"] = address
|
||||||
|
|
||||||
registry.Register(&plugin.Registration{
|
registry.Register(&plugin.Registration{
|
||||||
Type: t,
|
Type: t,
|
||||||
ID: name,
|
ID: name,
|
||||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||||
ic.Meta.Exports["address"] = address
|
ic.Meta.Exports = exports
|
||||||
ic.Meta.Platforms = append(ic.Meta.Platforms, p)
|
ic.Meta.Platforms = append(ic.Meta.Platforms, p)
|
||||||
conn, err := clients.getClient(address)
|
conn, err := clients.getClient(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user