Get configuration root in v5 #3051
-
How do I get the root configuration object (and destructure from it)? In v4, you could do: import configuration from "@feathersjs/configuration"
const config = configuration()()
const { db } = config ...but this no longer works. I understand that you can call |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I don't think that usage has changed, it should still return the configuration when called that way (see https://github.com/feathersjs/feathers/blob/dove/packages/configuration/src/index.ts#L13). What is it returning now? |
Beta Was this translation helpful? Give feedback.
-
After more digging, it seems related to I utilize NODE_OPTIONS='-r dotenv/config --no-warnings' ts-node src/ ...so |
Beta Was this translation helpful? Give feedback.
-
You can try switching the config files from json to cjs format then you can have access to env variables in the config like so module.exports = {
host: process.env.HOST || '127.0.0.1',
port: process.env.PORT || 3000,
} |
Beta Was this translation helpful? Give feedback.
I don't think that usage has changed, it should still return the configuration when called that way (see https://github.com/feathersjs/feathers/blob/dove/packages/configuration/src/index.ts#L13). What is it returning now?