Created
March 29, 2024 23:51
-
-
Save MushuLeDragon/a4a7b0a7f971e76088b24ad67c654cab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dotenv from 'dotenv'; | |
dotenv.config(); | |
const params = { | |
username: process.env.DATABASE_USERNAME, | |
password: process.env.PASSWORD, | |
host: process.env.HOST, | |
port: process.env.PORT, | |
databaseName: process.env.DATABASENAME, | |
}; | |
export const url = `mongodb://${params.username}:${params.password}@${params.host}:${params.port}/${params.databaseName}?retryWrites=true&w=majority`; | |
// export const url = `mongodb+srv://${params.username}:${params.password}@${params.host}/${params.databaseName}?retryWrites=true&w=majority`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.1' | |
services: | |
mongo: | |
image: mongo:7.0 | |
container_name: mongo | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: mongadmin | |
MONGO_INITDB_ROOT_PASSWORD: testtest | |
MONGO_INITDB_DATABASE: my_db | |
ports: | |
- 27017:27017 | |
volumes: | |
- ./.datas:/data/db | |
mongo-express: | |
image: mongo-express | |
container_name: mongoexpress | |
ports: | |
- 8081:8081 | |
environment: | |
ME_CONFIG_MONGODB_ADMINUSERNAME: mongadmin | |
ME_CONFIG_MONGODB_ADMINPASSWORD: testtest | |
ME_CONFIG_MONGODB_URL: mongodb://mongadmin:testtest@mongo:27017/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment