Skip to content
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 module options to be passed as ['nuxt-security', options] #87

Closed
Pierre-M opened this issue Jan 26, 2023 · 4 comments
Closed

Allow module options to be passed as ['nuxt-security', options] #87

Pierre-M opened this issue Jan 26, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Pierre-M
Copy link

Version

nuxt-security: 0.10.1
nuxt: 3.1.0

Steps to reproduce

In you Nuxt config, add the nuxt-security module as a [moduleName, moduleOptions] entry.

export default defineNuxtConfig({
  modules: [
    ["nuxt-security", {headers: {...}}]
  ]
})

What is Expected?

The passed configuration should be taken into account.

What is actually happening?

The module options are only handled if they are passed through the security configuration key in Nuxt config.

Possible fix

In the module definition, instead of using explicitly nuxt.options.security to retrieve passed options, you should use options directly :

{
    setup(options, nuxt) {
    // ...
    nuxt.options.security = defuReplaceArray(options, {
      ...defaultSecurityConfig
    });
}

Thanks for you module, it's a really huge and valuable work 🤗

@Pierre-M Pierre-M added the bug Something isn't working label Jan 26, 2023
@Baroshem
Copy link
Owner

Hey, thanks for reporting that!

I will take a look at it in the upcoming days :)

Also, I am glad that you like it!

@runyasak runyasak mentioned this issue Jan 26, 2023
6 tasks
@runyasak
Copy link
Contributor

Hi, @Baroshem.
I have sent PR to resolve this issue.
Please, checkout on this #88.

@Baroshem Baroshem added enhancement New feature or request and removed bug Something isn't working labels Jan 28, 2023
@Baroshem
Copy link
Owner

Thanks to the PR by @runyasak this functionality is now merged to main. I will work on few other functionalities this week and will release a new version with a support for that feature.

Stay tuned! :)

@Baroshem
Copy link
Owner

Closing the issue as the functionality was merged and released as 0.10.2 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants