egg
egg copied to clipboard
Enable plugin dynamically
How can I enable plugin at runtime?
See https://github.com/eggjs/egg/issues/3262#issuecomment-444483287
I want to have a disabled redis in workers and enable it later at some worker startup
Also I have same process.env.EGG_SERVER_ENV
for both application and workers , process.env.EGG_SERVER_ENV=prod
Reply please
No, the plugins can't be disable after application startup
@whxaxes I don't want disable it , I want enable after application startup
@sm2017 It also can't be enable after application startup. Why you need to enable plugin later at startup?
I have a egg web application, and need to create some cli application TO SHARE CODES I CREATED IN WE APP , I use egg with commander js for cli applications, commander js parses args and according to first arg , we have different cli application
I need to disable some plugin , in some cli application, but dont want to create multiple env or many config files I
Sorry, eggjs doesn't support enable plugin dynamically now, Using multiple config files instead.
you can pass an option plugins to specify which plugin can be enable/disable
@popomore how exactly?
Using EGG_PLUGINS https://github.com/eggjs/egg-core/blob/master/lib/loader/mixin/plugin.js#L72
Or options.plugins https://github.com/eggjs/egg-core/blob/master/lib/loader/mixin/plugin.js#L81