Skip to content

Commit

Permalink
Merge pull request #88 from runyasak/fix/module-options
Browse files Browse the repository at this point in the history
[Fix] Module Options
  • Loading branch information
Baroshem committed Jan 28, 2023
2 parents ac9996f + d03be50 commit edf73f2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
22 changes: 22 additions & 0 deletions README.md
Expand Up @@ -77,6 +77,28 @@ If you wish to modify them you can do so from the configuration:
}
```

Or, you can pass options directly

```js{}[nuxt.config.js]
export default defineNuxtConfig({
modules: [
[
'nuxt-security',
{
requestSizeLimiter: {
value: {
maxRequestSizeInBytes: 3000000,
maxUploadFileRequestInBytes: 9000000,
},
route: '/upload-file'
}
// Other options
}
]
]
})
```

For all available configuration options check out the [docs](https://nuxt-security.vercel.app)

## Development
Expand Down
21 changes: 21 additions & 0 deletions docs/content/1.getting-started/1.quick-start.md
Expand Up @@ -52,6 +52,27 @@ And that's it! The Nuxt Security module will now register routeRoules and middle
})
```

Or, you can pass options directly

```js{}[nuxt.config.js]
export default defineNuxtConfig({
modules: [
[
'nuxt-security',
{
requestSizeLimiter: {
value: {
maxRequestSizeInBytes: 3000000,
maxUploadFileRequestInBytes: 9000000,
},
route: '/upload-file'
}
// Other options
}
]
]
})
```
::alert{type="info"}
You can find more about configuring `nuxt-security` [here](/getting-started/configuration).
::
2 changes: 1 addition & 1 deletion src/module.ts
Expand Up @@ -39,7 +39,7 @@ export default defineNuxtModule<ModuleOptions>({
// TODO: Migrate to createResolver (from @nuxt/kit)
const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url))
nuxt.options.build.transpile.push(runtimeDir)
nuxt.options.security = defuReplaceArray(nuxt.options.security, {
nuxt.options.security = defuReplaceArray({ ...options, ...nuxt.options.security }, {
...defaultSecurityConfig
})
const securityOptions = nuxt.options.security
Expand Down

1 comment on commit edf73f2

@vercel
Copy link

@vercel vercel bot commented on edf73f2 Jan 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nuxt-security – ./

nuxt-security.vercel.app
nuxt-security-baroshem.vercel.app
nuxt-security-git-main-baroshem.vercel.app

Please sign in to comment.