Ask your question
Should the working example below be the officially recommended way of configuring a nuxt-session?
Additional information
Using the example below based on the docs for configuring the redis session storage is partially broken / misleading.
// file: ~/nuxt.config.ts
export default defineNuxtConfig({
modules: ['@sidebase/nuxt-session'],
session: {
session: {
storageOptions: {
driver: 'redis',
options: {
url: process.env['REDIS_URL']
}
}
}
}
})
It is working well in a local dev setup, but breaks, when the app is built into a docker container. Most probably, because at build time, we deliberately do not supply the value of the REDIS_URL env var, the storage driver falls back to its default value.
I've found, that the config is actually read via nuxt's useRuntimeConfig function and supplying the config below, makes it work in both local and prod setups.
export default defineNuxtConfig({
modules: ['@sidebase/nuxt-session'],
runtimeConfig: {
session: {
session: {
storageOptions: {
driver: 'redis',
options: {
url: () => process.env['REDIS_URL']
}
}
}
}
}
})
Ask your question
Should the working example below be the officially recommended way of configuring a nuxt-session?
Additional information
Using the example below based on the docs for configuring the redis session storage is partially broken / misleading.
It is working well in a local dev setup, but breaks, when the app is built into a docker container. Most probably, because at build time, we deliberately do not supply the value of the
REDIS_URLenv var, the storage driver falls back to its default value.I've found, that the config is actually read via nuxt's
useRuntimeConfigfunction and supplying the config below, makes it work in both local and prod setups.