Skip to content

Commit

Permalink
Added environment variables to prod docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispinkney committed Mar 26, 2021
1 parent e3fc360 commit be88475
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/env.development
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ USERS_PORT=6666
USERS_URL=http://localhost/v1/user
FIRESTORE_EMULATOR_HOST=localhost:8088


################################################################################
# Posts Service
################################################################################
Expand Down
1 change: 1 addition & 0 deletions config/env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ USERS_PORT=6666
# Users Service URL
USERS_URL=https://dev.api.telescope.cdot.systems/v1/users


################################################################################
# Feed Discovery Service
################################################################################
Expand Down
10 changes: 10 additions & 0 deletions docker/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ services:
environment:
- NODE_ENV=production
- USERS_PORT
- FIREBASE_TYPE
- FIREBASE_PROJECT_ID
- FIREBASE_PRIVATE_KEY_ID
- FIREBASE_PRIVATE_KEY
- FIREBASE_CLIENT_EMAIL
- FIREBASE_CLIENT_ID
- FIREBASE_AUTH_URI
- FIREBASE_TOKEN_URI
- FIREBASE_AUTH_PROVIDER_X509_CERT_URL
- FIREBASE_CLIENT_X509_CERT_URL
# TODO
# - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
# - ELASTIC_APM_SERVICE_NAME=user
Expand Down
7 changes: 4 additions & 3 deletions src/api/users/src/services/firestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
client_email: FIREBASE_CLIENT_EMAIL,
client_id: FIREBASE_CLIENT_ID,
auth_uri: FIREBASE_AUTH_URI,
Expand All @@ -42,13 +42,14 @@ if (
client_x509_cert_url: FIREBASE_CLIENT_X509_CERT_URL,
}),
});
logger.debug('Server running in online mode');
logger.info('Server running in online mode');
} else {
process.env.FIRESTORE_EMULATOR_HOST = 'localhost:8088';
admin.initializeApp({
projectId: 'telescope',
credential: admin.credential.applicationDefault(),
});
logger.debug('Server running in emulator mode');
logger.info('Server running in emulator mode');
}

module.exports = admin.firestore();

0 comments on commit be88475

Please sign in to comment.