Skip to content

CLI v5.8.12 (still) does not create the proper env var for MongoDB! #451

@malhusseiny

Description

@malhusseiny

A MongoDB service with the following docker-compose configuration in compose.yml:

mongo:
  image: mongo
  restart: always
  environment:
    MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER:-app}
    MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD:-!ChangeMe!}
    MONGO_INITDB_DATABASE: ${MONGODB_DB:-symfony}

causes the variables MONGO_DATABASE, MONGO_DB , MONGO_NAME to be set to symfony, which is fine. However, it also sets the authSource param of MONGO_URL to symfony as shown below:

symfony var:export --multiline             
export MONGO_DATABASE=symfony
export MONGO_DB=symfony
export MONGO_HOST=127.0.0.1
export MONGO_NAME=symfony
export MONGO_PASSWORD=!ChangeMe!
export MONGO_PORT=32795
export MONGO_SCHEME=mongodb
export MONGO_SERVER=mongodb://127.0.0.1:32795
export MONGO_URL=mongodb://app:!ChangeMe!@127.0.0.1:32795/?authSource=symfony
export MONGO_USER=app
export MONGO_USERNAME=app

Without the MONGO_INITDB_DATABASE: ${MONGODB_DB:-symfony} in the docker compose file, all database-related environment variables as well as the authSource param become empty. It would be great if you could untangle that coupling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions