refactor: centralize server port resolution#4198
Open
KristjanESPERANTO wants to merge 1 commit into
Open
Conversation
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I took a look at the last remaining FIXME comment in the code - the one in
js/app.jspointing to PR #673. It's from 2017 and was already flagged as a hotfix back then.The problem:
MM_PORTgot written into a globalglobal.mmPortthat was then read inconsistently across the code - sometimes via the global, sometimes straight fromprocess.env, plus separate logic indefaults.js. Three ways to get the same port.I pulled this into a single
getServerPort()helper (MM_PORT->config.port->8080) and switchedapp.js,defaults.js,server.js,electron.jsand both serveronly files over to it. The global is gone now.Basically the behavior should be unchanged.