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
setModuleDefaults behaves differently from loadFileConfigs() when the defaults collide with config utility functions #689
Comments
This seems to be caused by util.makeHidden(). You can't assign to an object once you've defined a property by the same name. |
Are you suggesting we add support for Reserved Keywords by allowing |
I disagree. However, I'm leaving this open because the documentation could be clearer on this behavior difference. |
@markstos You've glossed over the real issue and picked on the commentary.
That's a bug, and has nothing at all to do with pinning. |
@jdmarshall - is this a problem beyond the 3 Reserved Keywords of While it would be better to have zero reserved keywords, it seems like a pretty major undertaking to remove them. So, yea, if you try to use one of the reserved keywords, undefined results may occur. I don't think we've thought of all the problems related to trying to use these keywords, or workarounds. |
If the underlying issue is the inconsistency in the way it fails if you try to use one of the 3 reserved keywords, I'd be happy to have a conversation with someone willing to make this failure more consistent, and submitting a PR. |
I took a stab at solving this a couple weeks ago, but I couldn't get a simple repro case to behave consistently. I thought perhaps that meant the last couple of PRs changed some data flow that I didn't quite understand, but it turns out the problem does still occur within my real code. Interestingly, I have two spots in the config where this should fail, but one does not. I'm trying to nail down what the difference is, but it seems to have something to do with whether the reserved words have siblings or not. |
Got it. PR filed. The crux is the lack of configurable=true in defineProperty() calls. These will get mopped up by |
I'm submitting a ...
What is the current behavior?
If your default.js file contains a key that collides with node-config's extendDeep() helpers, such as 'get', then config figures it out and leaves the value. However when you pass in values via setModuleDefaults, they don't get copied because the function already exists.
What is the expected behavior?
setModuleDefaults() and extendDeep() should have the same semantics, so that loadFileConfigs behaves the same as setting defaults.
Please tell us about your environment:
Other information
(e.g. are you using an environment besides Node.js?)
The text was updated successfully, but these errors were encountered: