-
Notifications
You must be signed in to change notification settings - Fork 189
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
Closes Issue #1932: Added environment variables to prod's Docker file #2027
Conversation
@@ -33,7 +33,7 @@ if ( | |||
type: FIREBASE_TYPE, | |||
project_id: FIREBASE_PROJECT_ID, | |||
private_key_id: FIREBASE_PRIVATE_KEY_ID, | |||
private_key: FIREBASE_PRIVATE_KEY, | |||
private_key: FIREBASE_PRIVATE_KEY.replace(/\\n/g, '\n'), // escape the newline characters so docker can properly parse the key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there newline characters in it at all? It should be a single line of text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a single line of text but it does have newline characters in it. I was getting private key errors without this fix (that someone suggested on stackoverflow)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other files where we do this, we've been reading a file (cc @manekenpix, who has done this a bunch and probably has advice).
5f8dab9
to
3aa1840
Compare
Big thanks to @manekenpix who graciously spent some time to help me figure out how to get this mess working. |
* Dev and Docker mode now working both locally and in prod environments * Overriding FIRESTORE_EMULATOR_HOST in jest.config.e2e.js to pass tests * Removed dotenv (no longer needed) * Using cross-env * Utilizing require instead of fs for firestore keys * Refactored firestore.js * Removed unused variables * Added comments, cleaned up key require in firestore.js, rebased
17a71a6
to
3a08048
Compare
Issue This PR Addresses
Closes Issue #1932
Type of Change
Description
This PR adds the required environment variables for the Users MS to prod's Docker file. I added some test values and
console.log
'd them after runningdocker-compose --env-file config/env.production up --build
and they all displayed just fine. Users should be set up and ready to go once we finally create a Firebase project for Telescope (don't quote me on this.)I also hardcoded an environment variable (
process.env.FIRESTORE_EMULATOR_HOST = 'localhost:8088'
)infirestore.js
which allows developers to test locally when usingnpm run services:start firebase
andcd src/api/users && npm run dev
together. This environment variable is only injected when running in dev mode.To be completely honestly, it's hacky but I couldn't get get the dev version of the users ms to work when running via Docker, only when running using
npm run dev
. I'd love to spend some time with someone to try and figure this out (as well as properly test prod), as it's worrisome that prod may not actually work, but it is at least set up with this PR.Checklist