N
Nuxtβ€’5mo ago
szobi

Problem with envs in docker

Helllo, l have a problem with envs to redis connect l hosted app in docker with custom image its my nuxt.config
runtimeConfig: {
redisHost: '',
redisPort: '',
redisPassword: '',
redisUsername: '',
runtimeConfig: {
redisHost: '',
redisPort: '',
redisPassword: '',
redisUsername: '',
server/plugins/storage.ts
import redisDriver from 'unstorage/drivers/redis'

export default defineNitroPlugin(() => {

const config = useRuntimeConfig()
console.log(config)
const storage = useStorage()
const driver = redisDriver({
base: '',
host: config.redisHost,
// @ts-ignore set REDIS_PORT AS number
port: config.redisPort as number,
username: config.redisUsername,
password: config.redisPassword,

})

// Mount driver
storage.mount('redis', driver)
})
import redisDriver from 'unstorage/drivers/redis'

export default defineNitroPlugin(() => {

const config = useRuntimeConfig()
console.log(config)
const storage = useStorage()
const driver = redisDriver({
base: '',
host: config.redisHost,
// @ts-ignore set REDIS_PORT AS number
port: config.redisPort as number,
username: config.redisUsername,
password: config.redisPassword,

})

// Mount driver
storage.mount('redis', driver)
})
But after docker compose up app see only envs from runTime.public redisHost and others are empty 😦 and redis want connect to default 127.0.0.1 server any ideas?
1 Reply
szobi
szobiOPβ€’5mo ago
Now in defineNitroPlugin config is undefined and nuxt get me
[nitro] [unhandledRejection] TypeError: Cannot read properties of undefined (reading 'runtimeConfig')
[nitro] [unhandledRejection] TypeError: Cannot read properties of undefined (reading 'runtimeConfig')
in console
Want results from more Discord servers?
Add your server