How to use the firebase-admin.bootstrapInstance function in firebase-admin

To help you get started, we’ve selected a few firebase-admin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github casetext / fireproof / test / setup.js View on Github external
before(function(done) {

  this.timeout(10000);

  if (process.env.FIREBASE_TEST_URL && process.env.FIREBASE_TEST_SECRET) {

    console.log('using instance at', process.env.FIREBASE_TEST_URL);
    global.firebase = new Firebase(process.env.FIREBASE_TEST_URL);
    global.firebaseAuthSecret = process.env.FIREBASE_TEST_SECRET;
    done();

  } else if (process.env.FIREBASE_ADMIN_TOKEN) {

    require('firebase-admin')
    .bootstrapInstance(process.env.FIREBASE_ADMIN_TOKEN)
    .delay(1000)
    .then(function(instance) {

      global.__bootstrappedFirebase = instance;
      console.log('bootstrapped instance', instance.toString(), 'for tests');
      global.firebase = new Firebase(instance.toString());
      global.firebaseUrl = instance.toString();
      return instance.getAuthTokens();

    })
    .then(function(tokens) {
      global.firebaseAuthSecret = tokens[0];
    }).done(done);

  } else {