-
Notifications
You must be signed in to change notification settings - Fork 97
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
Pass the filepath to parse() #61
Comments
@malandrew we have just recently officially removed this feature. If you want to make changes to rc you need to make a really solid case about why this is a worthwhile change, and how you intend to use it. |
@dominictarr I believe I have the same requirement - I want to be able to load CA files for proxies when specified in the Edit: Or even a normalize function that just returns the input by default, but can be overridden? |
@blakeembrey so, reading between your lines, you have other files related to your config that you want to load - is the location of these files specified in the config files or are they just in a specific location relative to the config files? |
Yes, relative to the |
hmm... well, loading those files is not something that should happen in a parse function. or maybe... |
@dominictarr No, loading shouldn't happen there - I was only suggesting resolving to the absolute path could occur there. As for where things are stored, I guess I could enforce it - it's just not right now. |
oh okay, yeah resolving to the absolute path could work, but it could also be problematic because possiblely there are already people using configurations with things that look like relative files but aren't meant to be interpreted like that... I think it would have to be a major version |
I don't know about magical parsing of things that look like paths. If you don't want to include the filename as part of the parse step, what about providing a validate step that can take the result and return a new one? That way validation can occur of each file (E.g. check for strings/numbers/etc) and it remains backward compatible. |
Oh, I'm open to doing a PR for each to show the difference - I believe supporting the parser is less of a big change, but I don't mind writing a demonstration. |
Yeah, I'm a bit torn here, definately having absolute paths in a config file is a pain, but changing everything that looks like an relative path to be an absolute one. That said, I havn't felt a strong need for filepaths in my own configs, and when I do need something like that I've just made a config directory. Also, What I'd really like to see is another person who needs this feature, and what their use case looks like. |
My PR (#85) will make it so this is not needed for extension specific parsing. |
That looks really complex and fragile. A much simpler solution is to:
Edit: To clarify, I never submitted a PR because it was stated that someone else needed to be interested. |
Why do you think it is really fragile? Can you point out specific places? Also, can you please move discussion of the PR to the PR itself? |
@legodude17 It just introduces more complexity that isn't really required in the core module. For instance, if you received the filename in the |
I commented here because mine is a different solution than this one. If you don't like, your dislike is noted, I can't please everyone. |
It's not related at all. Did you actually read this issue? It's about resolving filenames inside the configuration. |
I would like to write a parser that resolves any values that are relative paths (starts with ./ or ../ and fs.existsSync returns true) to absolute paths. The parser would need to know the location of the file in order to be able to resolve a potential path and confirm the file exists.
I would submit a PR for this today, but I'm still trying to figunavigatere my company's open source contribution policy.
The text was updated successfully, but these errors were encountered: