Add custom Mongo Express config to disable auth
This commit is contained in:
parent
f38cf5f495
commit
f20610df8b
|
|
@ -39,6 +39,8 @@ services:
|
||||||
container_name: mongo-express
|
container_name: mongo-express
|
||||||
hostname: mongo-express
|
hostname: mongo-express
|
||||||
restart: always
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./mongo-express-config.js:/node_modules/mongo-express/config.js:ro
|
||||||
environment:
|
environment:
|
||||||
- ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_ROOT_USERNAME:-admin}
|
- ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_ROOT_USERNAME:-admin}
|
||||||
- ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_ROOT_PASSWORD:-password}
|
- ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_ROOT_PASSWORD:-password}
|
||||||
|
|
@ -46,12 +48,9 @@ services:
|
||||||
- ME_CONFIG_MONGODB_AUTH_DATABASE=admin
|
- ME_CONFIG_MONGODB_AUTH_DATABASE=admin
|
||||||
# Fix connection string format
|
# Fix connection string format
|
||||||
- ME_CONFIG_MONGODB_URL=mongodb://${MONGO_ROOT_USERNAME:-admin}:${MONGO_ROOT_PASSWORD:-password}@mongodb:27017/?authSource=admin
|
- ME_CONFIG_MONGODB_URL=mongodb://${MONGO_ROOT_USERNAME:-admin}:${MONGO_ROOT_PASSWORD:-password}@mongodb:27017/?authSource=admin
|
||||||
# Disable basic authentication for easier access
|
# Explicitly disable basic auth
|
||||||
# - ME_CONFIG_BASICAUTH_USERNAME=${MONGOEXPRESS_USERNAME:-mexpress}
|
- ME_CONFIG_BASICAUTH_USERNAME=
|
||||||
# - ME_CONFIG_BASICAUTH_PASSWORD=${MONGOEXPRESS_PASSWORD:-mexpress}
|
- ME_CONFIG_BASICAUTH_PASSWORD=
|
||||||
- ME_CONFIG_MONGODB_ENABLE_ADMIN=true
|
|
||||||
# Remove the base URL path so it works at root path
|
|
||||||
# - ME_CONFIG_SITE_BASEURL=/mongo-express
|
|
||||||
ports:
|
ports:
|
||||||
- "8081:8081" # Expose Mongo Express web interface to external machines
|
- "8081:8081" # Expose Mongo Express web interface to external machines
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Custom Mongo Express configuration
|
||||||
|
module.exports = {
|
||||||
|
mongodb: {
|
||||||
|
// Connection string for MongoDB
|
||||||
|
connectionString: process.env.ME_CONFIG_MONGODB_URL || '',
|
||||||
|
|
||||||
|
// MongoDB server options
|
||||||
|
admin: true,
|
||||||
|
|
||||||
|
// MongoDB authentication options
|
||||||
|
adminUsername: process.env.ME_CONFIG_MONGODB_ADMINUSERNAME || 'admin',
|
||||||
|
adminPassword: process.env.ME_CONFIG_MONGODB_ADMINPASSWORD || 'password',
|
||||||
|
|
||||||
|
// Auth database name
|
||||||
|
auth: [
|
||||||
|
{
|
||||||
|
database: process.env.ME_CONFIG_MONGODB_AUTH_DATABASE || 'admin',
|
||||||
|
username: process.env.ME_CONFIG_MONGODB_ADMINUSERNAME || 'admin',
|
||||||
|
password: process.env.ME_CONFIG_MONGODB_ADMINPASSWORD || 'password',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Web server options
|
||||||
|
site: {
|
||||||
|
// Base URL path
|
||||||
|
baseUrl: '/',
|
||||||
|
|
||||||
|
// Web server port
|
||||||
|
port: process.env.ME_CONFIG_SITE_PORT || 8081,
|
||||||
|
|
||||||
|
// Web server host
|
||||||
|
host: '0.0.0.0'
|
||||||
|
},
|
||||||
|
|
||||||
|
// Options for basic authentication
|
||||||
|
basicAuth: {
|
||||||
|
// Disable basic authentication
|
||||||
|
username: '',
|
||||||
|
password: ''
|
||||||
|
},
|
||||||
|
|
||||||
|
// Other options
|
||||||
|
options: {
|
||||||
|
// Enable editing
|
||||||
|
editMode: true,
|
||||||
|
|
||||||
|
// Enable admin mode
|
||||||
|
adminMode: true
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue