mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-08 17:23:04 +02:00
creating a local.example.js as a sample file to extend configuration to local repository without committing these changes and also replacing .extend() with .merge() for local repository changes
This commit is contained in:
@@ -7,14 +7,26 @@ var _ = require('lodash'),
|
||||
glob = require('glob'),
|
||||
fs = require('fs');
|
||||
|
||||
/**
|
||||
* Resolve environment configuration by extending each env configuration file,
|
||||
* and lastly merge/override that with any local repository configuration that exists
|
||||
* in local.js
|
||||
*/
|
||||
var resolvingConfig = function() {
|
||||
var conf = {};
|
||||
|
||||
conf = _.extend(
|
||||
require('./env/all'),
|
||||
require('./env/' + process.env.NODE_ENV) || {}
|
||||
);
|
||||
|
||||
return _.merge(conf, (fs.existsSync('./config/env/local.js') && require('./env/local.js')) || {});
|
||||
};
|
||||
|
||||
/**
|
||||
* Load app configurations
|
||||
*/
|
||||
module.exports = _.extend(
|
||||
require('./env/all'),
|
||||
require('./env/' + process.env.NODE_ENV),
|
||||
(fs.existsSync('./config/env/local.js') && require('./env/local.js')) || {}
|
||||
);
|
||||
module.exports = resolvingConfig();
|
||||
|
||||
/**
|
||||
* Get files by glob patterns
|
||||
|
||||
23
config/env/local.example.js
vendored
Normal file
23
config/env/local.example.js
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
// Rename this file to local.js for having a local configuration variables that
|
||||
// will not get commited and pushed to remote repositories.
|
||||
// Use it for your API keys, passwords, etc.
|
||||
|
||||
/* For example:
|
||||
|
||||
module.exports = {
|
||||
db: {
|
||||
uri: 'mongodb://localhost/local-dev',
|
||||
options: {
|
||||
user: '',
|
||||
pass: ''
|
||||
}
|
||||
},
|
||||
facebook: {
|
||||
clientID: process.env.FACEBOOK_ID || 'APP_ID',
|
||||
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
|
||||
callbackURL: '/auth/facebook/callback'
|
||||
}
|
||||
};
|
||||
*/
|
||||
@@ -148,7 +148,7 @@ module.exports = function(grunt) {
|
||||
},
|
||||
copy: {
|
||||
localConfig: {
|
||||
src: 'config/env/development.js',
|
||||
src: 'config/env/local.example.js',
|
||||
dest: 'config/env/local.js',
|
||||
filter: function() {
|
||||
return !fs.existsSync('config/env/local.js');
|
||||
|
||||
Reference in New Issue
Block a user