-
-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow autoConfig
with callback
#381
Conversation
index.js
Outdated
let pluginOptions | ||
if (typeof pluginConfig === 'function') { | ||
pluginOptions = function (fastify) { | ||
return { ...pluginConfig(fastify), ...overrideConfig } | ||
} | ||
|
||
pluginOptions.prefix = pluginConfig.prefix | ||
} else { | ||
pluginOptions = { ...pluginConfig, ...overrideConfig } | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might do the job, but I think the whole component would benefit greatly from a major refactoring.
Right now, it really looks spaghetti code imho, it's hard to introduce changes cleanly.
EDIT: maybe with:
pluginOptions.prefix = overrideConfig.prefix ?? pluginConfig.prefix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open to work on it btw, but after the demo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'd be fantastic, thx 'b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #383
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@climba03003 ptal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Can be usefull to autoload plugins: