Firebase Cloud Function config to access other project db

functions.config().firebase is a reserved namespace and you won't be able to override it. However, you can do cross-project initialization yourself. Here's how I would do it:

First, download a service account for your other project into your functions directory. Name it <project_id>-sa.json. Next, set up some environment config (app.fb_project_id is just an example name, not a requirement):

firebase functions:config:set app.fb_project_id="<the_project_id>"

Now in your code, you can initialize the Admin SDK like so:

const functions = require('firebase-functions');
const admin = require('firebase-admin');

if (!functions.config().app || !functions.config().app.project_id) {
  throw new Error('Cannot start app without app.fb_project_id config.');
}

const FB_PROJECT_ID = functions.config().app.fb_project_id;
const SERVICE_ACCOUNT = require(`./${FB_PROJECT_ID}-sa.json`);

admin.initializeApp({
  databaseURL: `https://${FB_PROJECT_ID}.firebaseio.com`,
  credential: admin.credential.cert(SERVICE_ACCOUNT)
});

This will have initialized the Admin SDK for the other project.