Repository: ember-cli/ember-cli
Pull request #6166 (2016-08-10 07:23:48)

changed --insecure-proxy to --secure-proxy in ember serve command


Patch:
diff --git a/lib/commands/serve.js b/lib/commands/serve.js
index a91146963..81e732fdc 100644
--- a/lib/commands/serve.js
+++ b/lib/commands/serve.js
@@ -22,7 +22,7 @@ module.exports = Command.extend({
     { name: 'port',                 type: Number,  default: defaultPort,   aliases: ['p'] },
     { name: 'host',                 type: String,                          aliases: ['H'],     description: 'Listens on all interfaces by default' },
     { name: 'proxy',                type: String,                          aliases: ['pr', 'pxy'] },
-    { name: 'insecure-proxy',       type: Boolean, default: false,         aliases: ['inspr'], description: 'Set false to proxy self-signed SSL certificates' },
+    { name: 'secure-proxy',         type: Boolean, default: true,          aliases: ['spr'],   description: 'Set to false to proxy self-signed SSL certificates' },
     { name: 'transparent-proxy',    type: Boolean, default: true,          aliases: ['transp'], description: 'Set to false to omit x-forwarded-* headers when proxying' },
     { name: 'watcher',              type: String,  default: 'events',      aliases: ['w'] },
     { name: 'live-reload',          type: Boolean, default: true,          aliases: ['lr'] },
diff --git a/lib/tasks/server/middleware/proxy-server/index.js b/lib/tasks/server/middleware/proxy-server/index.js
index a4e21fe84..59df173e6 100644
--- a/lib/tasks/server/middleware/proxy-server/index.js
+++ b/lib/tasks/server/middleware/proxy-server/index.js
@@ -13,7 +13,7 @@ ProxyServerAddon.prototype.serverMiddleware = function(options) {
     var proxy = require('http-proxy').createProxyServer({
       target: options.proxy,
       ws: true,
-      secure: !options.insecureProxy,
+      secure: options.secureProxy,
       changeOrigin: true,
       xfwd: options.transparentProxy
     });


Test patch:
diff --git a/tests/fixtures/help/help-with-addon.txt b/tests/fixtures/help/help-with-addon.txt
index b3583fb5e..4f086ce0a 100644
--- a/tests/fixtures/help/help-with-addon.txt
+++ b/tests/fixtures/help/help-with-addon.txt
@@ -124,8 +124,8 @@ ember serve \u001b[36m<options...>\u001b[39m
     \u001b[90maliases: -H <value>\u001b[39m
   \u001b[36m--proxy\u001b[39m \u001b[36m(String)\u001b[39m
     \u001b[90maliases: -pr <value>, -pxy <value>\u001b[39m
-  \u001b[36m--insecure-proxy\u001b[39m \u001b[36m(Boolean)\u001b[39m \u001b[36m(Default: false)\u001b[39m Set false to proxy self-signed SSL certificates
-    \u001b[90maliases: --inspr\u001b[39m
+  \u001b[36m--secure-proxy\u001b[39m \u001b[36m(Boolean)\u001b[39m \u001b[36m(Default: true)\u001b[39m Set to false to proxy self-signed SSL certificates
+    \u001b[90maliases: -spr\u001b[39m
   \u001b[36m--transparent-proxy\u001b[39m \u001b[36m(Boolean)\u001b[39m \u001b[36m(Default: true)\u001b[39m Set to false to omit x-forwarded-* headers when proxying
     \u001b[90maliases: --transp\u001b[39m
   \u001b[36m--watcher\u001b[39m \u001b[36m(String)\u001b[39m \u001b[36m(Default: events)\u001b[39m
diff --git a/tests/fixtures/help/help.js b/tests/fixtures/help/help.js
index 64ee93749..c82609a09 100644
--- a/tests/fixtures/help/help.js
+++ b/tests/fixtures/help/help.js
@@ -488,11 +488,11 @@ module.exports = {
           required: false
         },
         {
-          name: 'insecure-proxy',
-          default: false,
-          description: 'Set false to proxy self-signed SSL certificates',
-          aliases: ['inspr'],
-          key: 'insecureProxy',
+          name: 'secure-proxy',
+          default: true,
+          description: 'Set to false to proxy self-signed SSL certificates',
+          aliases: ['spr'],
+          key: 'secureProxy',
           required: false
         },
         {
diff --git a/tests/fixtures/help/help.txt b/tests/fixtures/help/help.txt
index c74e740bd..48fe3ab98 100644
--- a/tests/fixtures/help/help.txt
+++ b/tests/fixtures/help/help.txt
@@ -124,8 +124,8 @@ ember serve \u001b[36m<options...>\u001b[39m
     \u001b[90maliases: -H <value>\u001b[39m
   \u001b[36m--proxy\u001b[39m \u001b[36m(String)\u001b[39m
     \u001b[90maliases: -pr <value>, -pxy <value>\u001b[39m
-  \u001b[36m--insecure-proxy\u001b[39m \u001b[36m(Boolean)\u001b[39m \u001b[36m(Default: false)\u001b[39m Set false to proxy self-signed SSL certificates
-    \u001b[90maliases: --inspr\u001b[39m
+  \u001b[36m--secure-proxy\u001b[39m \u001b[36m(Boolean)\u001b[39m \u001b[36m(Default: true)\u001b[39m Set to false to proxy self-signed SSL certificates
+    \u001b[90maliases: -spr\u001b[39m
   \u001b[36m--transparent-proxy\u001b[39m \u001b[36m(Boolean)\u001b[39m \u001b[36m(Default: true)\u001b[39m Set to false to omit x-forwarded-* headers when proxying
     \u001b[90maliases: --transp\u001b[39m
   \u001b[36m--watcher\u001b[39m \u001b[36m(String)\u001b[39m \u001b[36m(Default: events)\u001b[39m
diff --git a/tests/fixtures/help/with-addon-blueprints.js b/tests/fixtures/help/with-addon-blueprints.js
index c7660abb1..d814ecbec 100644
--- a/tests/fixtures/help/with-addon-blueprints.js
+++ b/tests/fixtures/help/with-addon-blueprints.js
@@ -520,11 +520,11 @@ module.exports = {
           required: false
         },
         {
-          name: 'insecure-proxy',
-          default: false,
-          description: 'Set false to proxy self-signed SSL certificates',
-          aliases: ['inspr'],
-          key: 'insecureProxy',
+          name: 'secure-proxy',
+          default: true,
+          description: 'Set to false to proxy self-signed SSL certificates',
+          aliases: ['spr'],
+          key: 'secureProxy',
           required: false
         },
         {
diff --git a/tests/fixtures/help/with-addon-commands.js b/tests/fixtures/help/with-addon-commands.js
index 82be7e949..980537891 100644
--- a/tests/fixtures/help/with-addon-commands.js
+++ b/tests/fixtures/help/with-addon-commands.js
@@ -488,11 +488,11 @@ module.exports = {
           required: false
         },
         {
-          name: 'insecure-proxy',
-          default: false,
-          description: 'Set false to proxy self-signed SSL certificates',
-          aliases: ['inspr'],
-          key: 'insecureProxy',
+          name: 'secure-proxy',
+          default: true,
+          description: 'Set to false to proxy self-signed SSL certificates',
+          aliases: ['spr'],
+          key: 'secureProxy',
           required: false
         },
         {
diff --git a/tests/unit/commands/serve-test.js b/tests/unit/commands/serve-test.js
index 66102a9d7..8d2759ad3 100644
--- a/tests/unit/commands/serve-test.js
+++ b/tests/unit/commands/serve-test.js
@@ -152,21 +152,21 @@ describe('serve command', function() {
     });
   });
 
-  it('has correct insecure proxy option', function() {
+  it('has correct secure proxy option', function() {
     return command.validateAndRun([
-      '--insecure-proxy'
+      '--secure-proxy', 'false'
     ]).then(function() {
       var captor = td.matchers.captor();
       td.verify(tasks.Serve.prototype.run(captor.capture()), {times: 1});
-      expect(captor.value.insecureProxy).to.equal(true, 'has correct insecure proxy option');
+      expect(captor.value.secureProxy).to.equal(false, 'has correct insecure proxy option');
     });
   });
 
-  it('has correct default value for insecure proxy', function() {
+  it('has correct default value for secure proxy', function() {
     return command.validateAndRun().then(function() {
       var captor = td.matchers.captor();
       td.verify(tasks.Serve.prototype.run(captor.capture()), {times: 1});
-      expect(captor.value.insecureProxy).to.equal(false, 'has correct insecure proxy option when not set');
+      expect(captor.value.secureProxy).to.equal(true, 'has correct secure proxy option when not set');
     });
   });