From 5e300e6537a43a730c76f289480fe4711f46f2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= <57442769+gjedlicska@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:20:27 +0100 Subject: [PATCH] add full redis config example --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 378ce4a..52b7606 100644 --- a/README.md +++ b/README.md @@ -254,12 +254,28 @@ You can use any storage driver supported by [unjs/unstorage](https://github.com/ // file: ~/nuxt.config.ts export default defineNuxtConfig({ modules: ['@sidebase/nuxt-session'], + // the build time config is needed, so that the nuxt module selects the right driver module during build session: { session: { storageOptions: { driver: 'redis', options: { - url: 'redis://localhost:6379' + } + } + } + }, + // the runtime config is needed, to specify the shape of the config object. + // a dummy value for the url, that can be overridden by nuxt's runtime env var system + // https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables + runtimeConfig: { + session: { + session: { + storageOptions: { + driver: 'redis', + options: { + // overriden by NUXT_SESSION_SESSION_STORAGE_OPTIONS_OPTIONS_URL env var + url: 'UNDEFINED' // you need to define the key, with a dummy value + } } } }