Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Hello,
I am currently using app platform with mongodb managed database and I am facing issues while trying to connect on the database from my nodejs component linked to the mongodb managed database.
The issue come from the certificate : I can’t upload it on the app platform component so I need to use the ‘CA_CERT’ database env variable (https://docs.digitalocean.com/products/app-platform/how-to/use-environment-variables/)
While doing this, I am facing a new issue : the env variable is displaying the whole certificate in a bad format (not even a path) and I need to clean it right after and I am literally doing :
// cert formatter which looks really ugly
const cert = env('CA_CERT').replaceAll(' ', '\n').replace('BEGIN\n', 'BEGIN ').replace('END\n', 'END ');
mongoose.connect(url, {
useNewUrlParser: true,
useUnifiedTopology: true,
sslCA: cert
});
with ssl=true instead of tls=true in mongo url.
I am looking for a better solution or an explanation about how should I use the app platform with mongodb managed database which is not shown on docs (https://docs.digitalocean.com/products/databases/mongodb/how-to/connect/).
Also, I appreciate these kind of articles (https://www.digitalocean.com/community/tech_talks/making-a-node-mongodb-app-on-digitalocean) but it is only for a local purpose and with the cert locally downloaded.
raphael.staebler
sunil2197
antoine
5abfc42589b946e79faf3d4681a650
Jamal
DriftingNavyFish
Pak
Chris Sheridan
AM-developers
SleepingAquamarineMantaRay
imerik1