Custom plugin options
See original GitHub issue🚀 Feature Proposal
I think it could be useful to allow passing custom options to the plugin defined by the app.js
.
After reading the discussion at https://github.com/fastify/fastify-cli/issues/26 I would like to propose an alternative approach: exposing a pluginOptions
property in app.js
, the same way the custom options for Fastify are passed using the options
property.
Motivation
In some cases, you might need to define custom options for the app.js
and you might want to be able to pass them directly through the options
object or let fastify-cli
inject them.
Example
app.js
module.exports = function (fastify, options, next) {
...
next()
})
module.exports.options = {} // Cusom Fastify options
module.exports.pluginOptions = {} //Custom plugins options injected by fastify-cli
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
5 Ways to Create a WordPress Plugin Settings Page
Need to create a settings page in a WordPress plugin and wondering what the best approach is? Let's take a look at various...
Read more >Custom Settings Page | Plugin Developer Handbook
Creating a custom settings page includes the combination of: creating an administration menu, using Settings API and Options API. Alert: Please read these ......
Read more >Create a Settings Options Page for a WordPress Plugin
Create an Options Page for a Plugin under Settings Menu. To create a sub-menu for your plugin in the dashboard 'Settings' menu, you...
Read more >How to add setting for custom plugin in the WordPress setting ...
1. Create your custom plugin folder inside the “plugins” folder of your Woo Commerce site. · 2. Create a new PHP file inside...
Read more >Create WordPress Plugin Settings Page - WPLauncher
Create WordPress Plugin Settings Page · Add your admin menu to the left sidebar in the admin dashboard along with a submenu item...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I understand your point, and I agree that it should be a different actor. I thought that exposing the options this way would have been more in line with how fastify options are exposed, and I was wrong. Just to be clear, though, I wasn’t suggesting using
pluginOptions
in tests, but the opposite. I would have used custom objects without knowing howapp.js
implemented the loading part. Anyway, I agree with you.I like this approach too.
Ok, so we can say that after #208 is merged, there is the groundwork for supporting this and that we would like to support it?
If the answer is yes, should I keep this issue open at this point, or should I open a new one?
Thank you again for the feedback.
I think adding support for passing in args would be nice.