Question

Mongo CRT file location with Apps service

How do I specify the crt file location on App platform for my Mongodb connection string? I can’t use environmental variables as the Mongodb connection string needs a file.

I don’t want to build into my docker image for security reasons. What is the best solution please?


Submit an answer
Answer a question...

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
June 30, 2022

Hi there,

One way to achieve this would be to create the CA certificate file in your app’s code directly right before initializing the MongoDB connection.

For example, if you are using NodeJS, it would look something like this:

fs.writeFileSync(path.resolve(__dirname, "mongodb.ca.crt"), process.env.CA_CERT)

Best,

Bobby