Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object references cause a bug #426

Closed
mkanako opened this issue Nov 19, 2020 · 2 comments
Closed

object references cause a bug #426

mkanako opened this issue Nov 19, 2020 · 2 comments

Comments

@mkanako
Copy link

mkanako commented Nov 19, 2020

I'm submitting a...


[ ] Regression 
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

export default registerAs('test', () => ({ var: 1 })); console.log(this.configService.get('test')) // { var:1 } good! console.log(this.configService.get('test.var')) // undefined ??wtf console.log(this.configService.get('test')) // { var: undefined }

the second and third calls return wrong value

Expected behavior

Environment


Nest version: 7.5.3

 
For Tooling issues:
- Node version: 15  
- Platform: Mac 

Others: @nestjs/config:0.6.0

@mkanako
Copy link
Author

mkanako commented Nov 19, 2020

first call get('test') ConfigService will set the test object reference to internal cache object
second call get('test.var')) ConfigService will call getFromProcessEnv and getFromValidatedEnv then they retrun undefined and set test.var of cache to undefined, note here test in cache is a reference, modify will effect real object

@kamilmysliwiec
Copy link
Member

This should be fixed in @nestjs/config@0.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants