2

I created docker backend application that uses Firebase Admin SDK - https://firebase.google.com/docs/admin/setup#node.js_2. At the startup, the application reads JSON file from somewhere.

FirebaseApp.Create(new AppOptions()
{
    Credential = GoogleCredential.FromFile("path/to/credentials_file.json"),
});

I want to deploy this application on the DigitalOcean app platform. Where I can save this credentials_file.json? Is it even supported for the DigitalOcean app platform?

NOTE:

  • The application is a public docker image, so I can't put the file inside the image.
AntonIva
  • 597
  • 1
  • 6
  • 22

1 Answers1

2

A less well known way to initialize the SDK is to use the cert function. Then you can simply pass the config as a single line JSON string:

import { cert, initializeApp } from "firebase-admin/app";


initializeApp({
  credential: cert(JSON.parse(process.env.FIREBASE_ADMIN_SDK_CONFIG)),
});
ralrom
  • 433
  • 3
  • 9