AntonIva
AntonIva

Reputation: 608

Where to save and read credential file for the DigitalOcean App Platform?

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:

Upvotes: 2

Views: 657

Answers (1)

ralrom
ralrom

Reputation: 543

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)),
});

Upvotes: 4

Related Questions