Created
May 17, 2018 20:10
-
-
Save miguelemosreverte/011d24dbf37dc7375399b38bdcaf2933 to your computer and use it in GitHub Desktop.
This file contains 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
I wanted for the server to run on DEV or PROD enviroments seammesly. | |
For that it was necessary for it to know which enviroment it was running on. | |
And that could be done in many ways, being a modification to the Dockerfile the most elegant. | |
Now since 3:46 PM I have been dealing with this bug, mainly because each time I make a change I need to rebuild the docker image. | |
Forum posts like this one https://imgur.com/a/YuRiIRO | |
seem to suggest that adding lines like this to Dockerfile | |
# Environment Variables | |
ENV iamIP2="10.118.225.199" | |
ENV iamPort 9999 | |
ENV iamPort2=9997 | |
should make JS code like this work: | |
console.log(process.env.iamIP2) // "10.118.225.199" | |
console.log(process.env.iamPort) // 9999 | |
console.log(process.env.iamPort2) // 9997 | |
It does not. This is the result it gives. | |
https://i.imgur.com/GXPbQhC.png | |
I will add to the spreadsheet this feature as a free one, because of the time it demanded | |
and because I did it as a perfeccionist. I would not, ever, add the info to the code itself. |
Fixed like THIS
https://imgur.com/a/vPvlByk
TL;DR
React was sanitizing my enviroment variables, leaving only the ones that start with REACT_APP
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Caused by THIS
facebook/create-react-app#1977