Open Javarome opened 3 years ago
Hmmmm, this is not something that exists in the latest version, 1.4.7 or the next version ^2.0.0.
Could you provide an example of how you're structuring your config object please? nestjs-config
started out as a 'laravel-like' config folder/file structure. So database config goes into a database.ts
file and to get that config you use config.get('database')
which would return the export object/class from database.ts.
Version ^2.0.0 currently only uses export default
to add config to the config service. I have been thinking about enabling all exports which sounds similar to your request? But not completely.
Let me know how you're expecting to use the package and I'll see if it's possible to tweek.How comes you're using version 0.5.0 though?
It's a pretty standard pattern for an app to log out its config when it bootstraps itself. I don't know Jerome's use case, but mine is pretty simple, in our configureApp() method:
const configService = app.get(ConfigService)
ROOT_LOGGER.info(configService.get(), 'Initial Container Configuration');
Alternatively, if you had a method in ConfigService that returned the available configuration namespaces as an array, I could then do the dump by walking the namespaces returned.
Issue type:
nestjs-config version 0.5.0
@nestjs/common+core or other package versions
Excepted behavior
serviceConfig.get()
returns root/whole config object.Actual behavior or outcome (for issue)
A parameter is mandatory to get a specific field of the config.
Replication/Example
I defined my config as a complex object with fields being sub-objects, etc. and need to provide that object to another party (a database, some service, the frontend, whatever).
Today:
is not allowed.
and I'm constrained to break encapsulation by doing: