fix plugin init

This commit is contained in:
Asim Aslam 2019-09-10 05:32:49 -07:00
parent a5ce3e32da
commit 065c7d5616
2 changed files with 4 additions and 6 deletions

View File

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

View File

@ -62,8 +62,11 @@ 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`