Browse code

Use assets/config.local.js if present for development config

Samuel Padgett authored on 2015/11/14 06:19:09
Showing 4 changed files
... ...
@@ -5,6 +5,7 @@
5 5
 /.project
6 6
 /.vagrant
7 7
 /cpu.pprof
8
+/assets/app/config.local.js
8 9
 /assets/nbproject
9 10
 /examples/sample-app/openshift.local.*
10 11
 /examples/sample-app/logs/openshift.log
... ...
@@ -57,6 +57,10 @@ module.exports = function (grunt) {
57 57
         files: ['extensions/extensions.js', 'extensions/extensions.css'],
58 58
         tasks: ['copy:extensions']
59 59
       },
60
+      localConfig: {
61
+        files: ['<%= yeoman.app %>/config.local.js'],
62
+        tasks: ['copy:localConfig']
63
+      },
60 64
       gruntfile: {
61 65
         files: ['Gruntfile.js']
62 66
       },
... ...
@@ -67,6 +71,7 @@ module.exports = function (grunt) {
67 67
         files: [
68 68
           '<%= yeoman.app %>/{,*/}*.html',
69 69
           '.tmp/styles/{,*/}*.css',
70
+          '.tmp/config.js',
70 71
           '.tmp/scripts/extensions.js',
71 72
           '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
72 73
         ]
... ...
@@ -474,6 +479,18 @@ module.exports = function (grunt) {
474 474
           src: 'extensions.css',
475 475
           dest: '.tmp/styles'
476 476
         }]
477
+      },
478
+      // config.local.js is for local customizations if it exists.
479
+      localConfig: {
480
+        files: [{
481
+          expand: true,
482
+          cwd: '<%= yeoman.app %>',
483
+          src: 'config.local.js',
484
+          dest: '.tmp',
485
+          rename: function(path, name) {
486
+            return path + '/config.js';
487
+          }
488
+        }]
477 489
       }
478 490
     },
479 491
 
... ...
@@ -482,7 +499,8 @@ module.exports = function (grunt) {
482 482
       server: [
483 483
         'less:development',
484 484
         'copy:styles',
485
-        'copy:extensions'
485
+        'copy:extensions',
486
+        'copy:localConfig'
486 487
       ],
487 488
       test: [
488 489
         'less:development'
... ...
@@ -41,6 +41,14 @@ The supported log levels are:
41 41
 
42 42
 Note: currently most of our logging either goes to INFO or ERROR
43 43
 
44
+#### Local configuration
45
+
46
+`assets/app/config.js` is the default configuration file for web console
47
+development. If you need to change the configuration, for example, to point to
48
+a different API server, copy `assets/app/config.js` to
49
+`assets/app/config.local.js` and edit the copy. `assets/app/config.local.js` is
50
+not tracked and will be used instead if it exists.
51
+
44 52
 #### Before opening a pull request
45 53
 1. If needed, run `hack/build-assets.sh` to update bindata.go
46 54
 2. Run the spec tests with `hack/test-assets.sh`
... ...
@@ -1,6 +1,9 @@
1 1
 // This is the default configuration for the dev mode of the web console.
2 2
 // A generated version of this config is created at run-time when running
3
-// the web console from the openshift binary
3
+// the web console from the openshift binary.
4
+//
5
+// To change configuration for local development, copy this file to
6
+// assets/app/config.local.js and edit the copy.
4 7
 window.OPENSHIFT_CONFIG = {
5 8
   api: {
6 9
     openshift: {
... ...
@@ -59,7 +62,7 @@ window.OPENSHIFT_CONFIG = {
59 59
     k8s: {
60 60
       hostPort: "localhost:8443",
61 61
       prefixes: {
62
-      	"v1": "/api"
62
+        "v1": "/api"
63 63
       },
64 64
       resources: {
65 65
         "bindings": true,
... ...
@@ -94,10 +97,10 @@ window.OPENSHIFT_CONFIG = {
94 94
     }
95 95
   },
96 96
   auth: {
97
-  	oauth_authorize_uri: "https://localhost:8443/oauth/authorize",
98
-  	oauth_redirect_base: "https://localhost:9000",
99
-  	oauth_client_id: "openshift-web-console",
100
-  	logout_uri: ""
97
+    oauth_authorize_uri: "https://localhost:8443/oauth/authorize",
98
+    oauth_redirect_base: "https://localhost:9000",
99
+    oauth_client_id: "openshift-web-console",
100
+    logout_uri: ""
101 101
   },
102 102
   loggingURL: "",
103 103
   metricsURL: ""