Skip to content

Commit

Permalink
Removed generated config and default development config, added defaul…
Browse files Browse the repository at this point in the history
…t production config.
  • Loading branch information
jackgr committed May 26, 2015
1 parent 3ed9b42 commit 86b5235
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 38 deletions.
32 changes: 14 additions & 18 deletions www/master/gulpfile.js
Expand Up @@ -142,8 +142,6 @@ var source = {

config: {
watch: [
'shared/config/development.json',
'shared/config/production.json',
'shared/config/development.json',
'shared/config/production.json'
],
Expand Down Expand Up @@ -341,23 +339,21 @@ gulp.task('config:base', function() {
});

gulp.task('config:copy', function() {
var environment = argv.env || 'development'; // change this to whatever default environment you need.

var environment = argv.env || (isProduction ? 'production' : 'development');
return gulp.src(['shared/config/' + environment + '.json', 'components/**/config/' + environment + '.json'])
.pipe(jsoncombine('generated-config.js',
function(data) {
var env = Object.keys(data).reduce(function(result, key) {
// Map the key "environment" to "/" and the keys "component/config/environment" to
// "component".
var newKey = key.replace(environment, '/').replace(/\/config\/\/$/, '');
result[newKey] = data[key];
return result;
}, {});

return new Buffer(JSON.stringify({'ENV': env}));
}))
.pipe(ngConstant({name: 'kubernetesApp.config', deps: [], constants: {ngConstant: true}}))
.pipe(gulp.dest(source.config.dest));
.pipe(jsoncombine('generated-config.js',
function(data) {
var env = Object.keys(data).reduce(function(result, key) {
// Map the key "environment" to "/" and the keys "component/config/environment" to "component".
var newKey = key.replace(environment, '/').replace(/\/config\/\/$/, '');
result[newKey] = data[key];
return result;
}, {});

return new Buffer(JSON.stringify({'ENV': env}));
}))
.pipe(ngConstant({name: 'kubernetesApp.config', deps: [], constants: {ngConstant: true}}))
.pipe(gulp.dest(source.config.dest));
});

gulp.task('copy:components', function() {
Expand Down
18 changes: 0 additions & 18 deletions www/master/shared/config/generated-config.js

This file was deleted.

9 changes: 9 additions & 0 deletions www/master/shared/config/production.example.json
@@ -0,0 +1,9 @@
{
"k8sApiServer": "ENV_K8S_API_SERVER",
"k8sDataServer": "ENV_K8S_DATA_SERVER",
"k8sDataPollMinIntervalSec": "ENV_K8S_DATA_POLL_MIN_INTERVAL_SEC",
"k8sDataPollMaxIntervalSec": "ENV_K8S_DATA_POLL_MAX_INTERVAL_SEC",
"k8sDataPollErrorThreshold": "ENV_K8S_DATA_POLL_ERROR_THRESHOLD",
"cAdvisorProxy": "ENV_C_ADVISOR_PROXY",
"cAdvisorPort": "ENV_C_ADVISOR_PORT"
}
@@ -1,6 +1,6 @@
{
"k8sApiServer": "http://127.0.0.1:8080/api/v1beta2",
"k8sApiv1beta3Server": "http://127.0.0.1:8080/api/v1beta3",
"k8sApiServer": "/api/v1beta2",
"k8sApiv1beta3Server": "/api/v1beta3",
"k8sDataServer": "/cluster",
"k8sDataPollMinIntervalSec": 10,
"k8sDataPollMaxIntervalSec": 120,
Expand Down

0 comments on commit 86b5235

Please sign in to comment.