Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect to CosmosDB in Azure #60

Open
shulevas opened this issue Mar 30, 2021 · 1 comment
Open

Connect to CosmosDB in Azure #60

shulevas opened this issue Mar 30, 2021 · 1 comment

Comments

@shulevas
Copy link

shulevas commented Mar 30, 2021

Hi!
Is there a way using mongo-express-docker to connect to CosmosDB in Azure? For this, a link of the following form is used: mongodb://username:password@host:port/[database]?ssl=true

I know there is a parameter ME_CONFIG_MONGODB_URL, but when using it I still need to specify something in the ME_CONFIG_MONGODB_SERVER and ME_CONFIG_MONGODB_PORT parameters. It looks like parameter ME_CONFIG_MONGODB_URL is not working.

@ANovokmet
Copy link

After tinkering around with it for a while, I managed to run mongo-express with Azure Cosmos DB. For the connection string, be sure to copy the "Node.js 3.0" one from the azure portal.

I am using docker and here is my docker-compose.yml

services:
    # run mongo-express targeting the Azure Cosmos DB
    mongoex:
      image: mongo-express
      environment:
        - ME_CONFIG_MONGODB_SERVER=
        - ME_CONFIG_MONGODB_URL=mongodb://user:pass@server:port/?ssl=true&retrywrites=false&maxIdleTimeMS=120000&appName=@app-name@
      volumes:
        - "./config.js:/node_modules/mongo-express/config.js:ro"
      ports:
      - "8081:8081"

And my ./config.js

module.exports = {
    mongodb: {
        connectionOptions: {
            ssl: true,
            sslValidate: false
        }
    }
};

These two options should be configurable by setting ME_CONFIG_MONGODB_SSL=true and ME_CONFIG_MONGODB_SSLVALIDATE=false, but for some reason only providing a custom config works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants