зеркало из https://github.com/docker/labs.git
769 B
769 B
3 - Configuration
Configuration (credentials, database connection string, ...) should be stored in the environment.
What does that mean for our application ?
In config/connections.js, we define the mongo connection and use MONGO_URL environment variable to pass the mongo connection string.
module.exports.connections = {
mongo: {
adapter: 'sails-mongo',
url: process.env.MONGO_URL
}
};
In config/model.js, we make sure the mongo connection defined above is the one used.
module.exports.models = {
connection: 'mongo',
migrate: 'safe'
};
Those changes enable to provide a different MONGO_URL very easily as it's defined in the environment.