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

Hostname Case-Sensitivity #637

Open
1 task done
dsbert opened this issue Feb 8, 2021 · 1 comment
Open
1 task done

Hostname Case-Sensitivity #637

dsbert opened this issue Feb 8, 2021 · 1 comment
Labels
4.0 Candidate for breaking change in 4.0 release collab-request pr-welcome

Comments

@dsbert
Copy link
Contributor

dsbert commented Feb 8, 2021

Note: for support questions, please use StackOverflow and tag your question with node-config. This repository's issues are reserved for feature requests and bug reports.

Before submitting a bug report, please search the issue tracker the wiki first. Many issues have already been discussed.

The wiki is located at: https://github.com/lorenwest/node-config/wiki

I'm submitting a ...

  • bug report
  • [ ] feature request
  • [ ] support request or question => Please do not submit support request or questions here, see note at the top of this template.

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem:

There are two issues here that lead to confusing behavior.

  1. The hostname value is treated as case-sensitive in the file look up even on a case-insensitive file system.
  2. On Windows (have not tested others), The hostname can produce a different cased value depending on what tool is being used.

For example:

// node
console.log(os.hostname());

myvirtualhost
// powershell
$env:COMPUTERNAME

MYVIRTUALHOST
// cmd
hostname

myvirtualhost

What is the expected behavior?

This RFC indicates hostnames are case-insensitive https://tools.ietf.org/html/rfc4343

If there's too much work to treat the hostname as case-insensitive in the code-base, it would at least be better in my opinion to normalize to lowercase or uppercase and add some information to the documentation to remove the ambiguity.

There is another issue related to this question but it was closed almost 6 years ago - #235

Please tell us about your environment:

  • node-config version: 3.3.1
  • node-version: 12

Other information

(e.g. are you using an environment besides Node.js?)

@markstos markstos added the 4.0 Candidate for breaking change in 4.0 release label Feb 15, 2022
@markstos
Copy link
Collaborator

I recommend this be resolved by standardizing the hostnames to lowercase and only loading the lowercase version of the hostname file. This could be breaking change for some.

node-config already checks a huge number of file variations, and supporting both myhost.json and MYHOST.json would only add to complexity and confusion in the future. And let's not talk about MyHost.json.

PR welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.0 Candidate for breaking change in 4.0 release collab-request pr-welcome
Projects
None yet
Development

No branches or pull requests

3 participants