Skip to content

Instantly share code, notes, and snippets.

@djom202
Created May 25, 2018 15:46
Show Gist options
  • Save djom202/da2145b1e20799191abb3d4170db9c60 to your computer and use it in GitHub Desktop.
Save djom202/da2145b1e20799191abb3d4170db9c60 to your computer and use it in GitHub Desktop.
Init firebase services in nodejs
module.exports = {
'type': '',
'project_id': '',
'private_key_id': '',
'private_key': '',
'client_email': '',
'client_id': '',
'auth_uri': '',
'token_uri': '',
'auth_provider_x509_cert_url': '',
'client_x509_cert_url': ''
};
var admin = require('firebase-admin');
if (env != 'production') serviceAccount = require('./firebase_env');
else serviceAccount = JSON.parse(Buffer.from(process.env.SERVICEACCOUNT, 'base64').toString('utf8'));
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: serviceAccount.databaseURL
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment