By vongole83
Hi
I am deploying an app using DigitalOcean Apps (Which was amazingly straightforward by the way!) However I can’t work out how to handle keys for my Firebase Admin connection. The docs specify that a JSON file should hold all the params: https://firebase.google.com/docs/admin/setup
The safest way to handle these creds securely would seem to be to use a build command to pull the JSON file from a store. (I want to use an environment variable to pull the right JSON file according to which environment I am deploying).
I was hoping to use a DO Space, but there appears to be no easy way to pull from it using a Build command as it needs to use the S3 API/ SDK which is not available to a build command for an App. Does anyone know how I might go about pulling this at build time?
Only other thing I can think is to run a shell script that builds my JSON from environment variables, but that seems like a sub-optimal solution!
Any suggestions welcome as I am quite new to this!
Thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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 (as an env var):
import { cert, initializeApp } from "firebase-admin/app";
initializeApp({
credential: cert(JSON.parse(process.env.FIREBASE_ADMIN_SDK_CONFIG)),
});
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.