FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

#286: Emulator UI should not connect to 0.0.0.0 for emulators by gautamsingal · Pull Request #312 · firebase/firebase-tools-ui · GitHub

#286: Emulator UI should not connect to 0.0.0.0 for emulators - #312

Merged
yuchenshi merged 2 commits into
firebase:masterfrom
gautamsingal:gautamsingal/task/286-wsl2-issue
Jun 18, 2020
Merged

#286: Emulator UI should not connect to 0.0.0.0 for emulators#312
yuchenshi merged 2 commits into
firebase:masterfrom
gautamsingal:gautamsingal/task/286-wsl2-issue

Conversation

Copy link
Copy Markdown
Contributor

Description:
- Added check whether info.host is not 0.0.0.0 or ::
- If it is present, then update the host with localhost else it remains same
- Pass the new value to hostAndPort

Description:
    - Added check whether info.host is not 0.0.0.0 or ::
    - If it is present, then update the host with localhost else it remains same
    - Pass the new value to hostAndPort

yuchenshi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for the contribution! This looks good, but one small nit: please use 127.0.0.1 for IPv4 and ::1 for IPv6 instead of localhost.

The reason is that localhost may be mapped to both on the hosts file and may differ on each device. IP addresses are more direct and uniformly handled.

Copy link
Copy Markdown
Contributor Author

@yuchenshi Will this be good?
const host = info.host === '0.0.0.0' || info.host === '::' ? info.host === '0.0.0.0' ? '127.0.0.1' : '::1' : info.host;

Copy link
Copy Markdown
Member

const host = info.host === '0.0.0.0' || info.host === '::' ? info.host === '0.0.0.0' ? '127.0.0.1' : '::1' : info.host;

That is logically correct, but for let's stay away from chained ternaries for clarity. I suggest:

let host = info.host;
if (host === '0.0.0.0') {
  host = '127.0.0.1';
} else if (host === '::') {
  host = '::1';
}

Description:
    - Added check whether info.host is not 0.0.0.0 or ::
    - If it is present, then update the host with localhost else it remains same
    - Pass the new value to hostAndPort

Copy link
Copy Markdown
Contributor Author

@yuchenshi Okay 😁

yuchenshi merged commit bdb1933 into firebase:master Jun 18, 2020

Copy link
Copy Markdown
Member

This will be included in the next release. Cheers!

Copy link
Copy Markdown
Contributor Author

Great! Thanks @yuchenshi . Cheers!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL