fix plugin init
This commit is contained in:
parent
a5ce3e32da
commit
065c7d5616
@ -92,11 +92,6 @@ var (
|
|||||||
EnvVar: "MICRO_CLIENT_POOL_TTL",
|
EnvVar: "MICRO_CLIENT_POOL_TTL",
|
||||||
Usage: "Sets the client connection pool ttl. e.g 500ms, 5s, 1m. Default: 1m",
|
Usage: "Sets the client connection pool ttl. e.g 500ms, 5s, 1m. Default: 1m",
|
||||||
},
|
},
|
||||||
cli.StringSliceFlag{
|
|
||||||
Name: "plugin",
|
|
||||||
EnvVar: "MICRO_PLUGIN",
|
|
||||||
Usage: "Comma separated list of plugins e.g /path/to/plugin.so",
|
|
||||||
},
|
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "register_ttl",
|
Name: "register_ttl",
|
||||||
EnvVar: "MICRO_REGISTER_TTL",
|
EnvVar: "MICRO_REGISTER_TTL",
|
||||||
|
@ -62,10 +62,13 @@ func (p *plugin) Init(c *Config) error {
|
|||||||
return fmt.Errorf("Invalid plugin %s", c.Name)
|
return fmt.Errorf("Invalid plugin %s", c.Name)
|
||||||
}
|
}
|
||||||
cmd.DefaultTransports[c.Name] = pg
|
cmd.DefaultTransports[c.Name] = pg
|
||||||
}
|
default:
|
||||||
return fmt.Errorf("Unknown plugin type: %s for %s", c.Type, c.Name)
|
return fmt.Errorf("Unknown plugin type: %s for %s", c.Type, c.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Load loads a plugin created with `go build -buildmode=plugin`
|
// Load loads a plugin created with `go build -buildmode=plugin`
|
||||||
func (p *plugin) Load(path string) (*Config, error) {
|
func (p *plugin) Load(path string) (*Config, error) {
|
||||||
plugin, err := pg.Open(path)
|
plugin, err := pg.Open(path)
|
||||||
|
Loading…
Reference in New Issue
Block a user