You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2017/04/10 17:12:03 UTC
[1/4] incubator-trafficcontrol git commit: only use
connect-livereload in dev mode
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/master dd3887358 -> c03453d8c
only use connect-livereload in dev mode
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/ad581766
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/ad581766
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/ad581766
Branch: refs/heads/master
Commit: ad581766223c3ee369328c29ae9364c09080091f
Parents: c2d55c7
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Apr 10 10:59:08 2017 -0600
Committer: Dewayne Richardson <de...@apache.org>
Committed: Mon Apr 10 11:11:57 2017 -0600
----------------------------------------------------------------------
traffic_ops/experimental/ui/conf/config.js | 2 +-
traffic_ops/experimental/ui/server.js | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ad581766/traffic_ops/experimental/ui/conf/config.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/conf/config.js b/traffic_ops/experimental/ui/conf/config.js
index 9666739..d1b1358 100644
--- a/traffic_ops/experimental/ui/conf/config.js
+++ b/traffic_ops/experimental/ui/conf/config.js
@@ -17,7 +17,7 @@
* under the License.
*/
-// this is the config that is consumed by server.js when running in dev mode
+// this is the config that is consumed by server.js
module.exports = {
timeout: '120s',
useSSL: false, // set to true if using ssl
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ad581766/traffic_ops/experimental/ui/server.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/server.js b/traffic_ops/experimental/ui/server.js
index 002ab61..5bdeee3 100644
--- a/traffic_ops/experimental/ui/server.js
+++ b/traffic_ops/experimental/ui/server.js
@@ -57,10 +57,14 @@ app.use(morgan('combined', {
app.use(errorhandler());
app.use(timeout(config.timeout));
-app.use(require('connect-livereload')({
- port: 35728,
- excludeList: ['.woff', '.flv']
-}));
+if (app.get('env') === 'dev') {
+ app.use(require('connect-livereload')({
+ port: 35728,
+ excludeList: ['.woff', '.flv']
+ }));
+} else {
+ app.set('env', 'production');
+}
// Enable reverse proxy support in Express. This causes the
// the "X-Forwarded-Proto" header field to be trusted so its
[2/4] incubator-trafficcontrol git commit: moves server.js to root of
project
Posted by de...@apache.org.
moves server.js to root of project
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c2d55c79
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c2d55c79
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c2d55c79
Branch: refs/heads/master
Commit: c2d55c79bca9dcda439dceec59c79375269c075d
Parents: f6e6afe
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Apr 10 10:54:36 2017 -0600
Committer: Dewayne Richardson <de...@apache.org>
Committed: Mon Apr 10 11:11:57 2017 -0600
----------------------------------------------------------------------
traffic_ops/experimental/ui/grunt/express.js | 2 +-
traffic_ops/experimental/ui/server.js | 98 +++++++++++++++++++++++
traffic_ops/experimental/ui/server/server.js | 98 -----------------------
3 files changed, 99 insertions(+), 99 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55c79/traffic_ops/experimental/ui/grunt/express.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/grunt/express.js b/traffic_ops/experimental/ui/grunt/express.js
index b6be794..97c3bda 100644
--- a/traffic_ops/experimental/ui/grunt/express.js
+++ b/traffic_ops/experimental/ui/grunt/express.js
@@ -20,7 +20,7 @@
module.exports = {
dev: {
options: {
- script: './server/server.js',
+ script: './server.js',
node_env: 'dev'
}
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55c79/traffic_ops/experimental/ui/server.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/server.js b/traffic_ops/experimental/ui/server.js
new file mode 100644
index 0000000..002ab61
--- /dev/null
+++ b/traffic_ops/experimental/ui/server.js
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+var constants = require('constants'),
+ express = require('express'),
+ http = require('http'),
+ https = require('https'),
+ path = require('path'),
+ fs = require('fs'),
+ morgan = require('morgan'),
+ errorhandler = require('errorhandler'),
+ timeout = require('connect-timeout');
+
+var config = require('./conf/config'),
+ logStream = fs.createWriteStream(config.log.stream, { flags: 'a' }),
+ useSSL = config.useSSL;
+
+// Disable for self-signed certs in dev/test
+process.env.NODE_TLS_REJECT_UNAUTHORIZED = config.reject_unauthorized;
+
+var app = express();
+// Add a handler to inspect the req.secure flag (see
+// http://expressjs.com/api#req.secure). This allows us
+// to know whether the request was via http or https.
+app.all ("/*", function (req, res, next) {
+ if (useSSL && !req.secure) {
+ var headersHost = req.headers.host.split(':');
+ var httpsUrl = 'https://' + headersHost[0] + ':' + config.sslPort + req.url;
+ // request was via http, so redirect to https
+ res.redirect(httpsUrl);
+ } else {
+ next();
+ }
+});
+
+app.use(express.static(config.files.static));
+app.use(morgan('combined', {
+ stream: logStream,
+ skip: function (req, res) { return res.statusCode < 400 }
+}));
+app.use(errorhandler());
+app.use(timeout(config.timeout));
+
+app.use(require('connect-livereload')({
+ port: 35728,
+ excludeList: ['.woff', '.flv']
+}));
+
+// Enable reverse proxy support in Express. This causes the
+// the "X-Forwarded-Proto" header field to be trusted so its
+// value can be used to determine the protocol. See
+// http://expressjs.com/api#app-settings for more details.
+app.enable('trust proxy');
+
+// Startup HTTP Server
+var httpServer = http.createServer(app);
+httpServer.listen(config.port);
+
+if (useSSL) {
+ //
+ // Supply `SSL_OP_NO_SSLv3` constant as secureOption to disable SSLv3
+ // from the list of supported protocols that SSLv23_method supports.
+ //
+ var sslOptions = {};
+ sslOptions['secureOptions'] = constants.SSL_OP_NO_SSLv3;
+
+ sslOptions['key'] = fs.readFileSync(config.ssl.key);
+ sslOptions['cert'] = fs.readFileSync(config.ssl.cert);
+ sslOptions['ca'] = config.ssl.ca.map(function(cert){
+ return fs.readFileSync(cert);
+ });
+
+ // Startup HTTPS Server
+ var httpsServer = https.createServer(sslOptions, app);
+ httpsServer.listen(config.sslPort);
+
+ sslOptions.agent = new https.Agent(sslOptions);
+}
+
+console.log("Traffic Ops UI Port : %s", config.port);
+console.log("Traffic Ops UI Proxy Port : %s", config.proxyPort);
+console.log("Traffic Ops UI SSL Port : %s", config.sslPort);
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c2d55c79/traffic_ops/experimental/ui/server/server.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/server/server.js b/traffic_ops/experimental/ui/server/server.js
deleted file mode 100644
index a6037eb..0000000
--- a/traffic_ops/experimental/ui/server/server.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-var constants = require('constants'),
- express = require('express'),
- http = require('http'),
- https = require('https'),
- path = require('path'),
- fs = require('fs'),
- morgan = require('morgan'),
- errorhandler = require('errorhandler'),
- timeout = require('connect-timeout');
-
-var config = require('../conf/config'),
- logStream = fs.createWriteStream(config.log.stream, { flags: 'a' }),
- useSSL = config.useSSL;
-
-// Disable for self-signed certs in dev/test
-process.env.NODE_TLS_REJECT_UNAUTHORIZED = config.reject_unauthorized;
-
-var app = express();
-// Add a handler to inspect the req.secure flag (see
-// http://expressjs.com/api#req.secure). This allows us
-// to know whether the request was via http or https.
-app.all ("/*", function (req, res, next) {
- if (useSSL && !req.secure) {
- var headersHost = req.headers.host.split(':');
- var httpsUrl = 'https://' + headersHost[0] + ':' + config.sslPort + req.url;
- // request was via http, so redirect to https
- res.redirect(httpsUrl);
- } else {
- next();
- }
-});
-
-app.use(express.static(config.files.static));
-app.use(morgan('combined', {
- stream: logStream,
- skip: function (req, res) { return res.statusCode < 400 }
-}));
-app.use(errorhandler());
-app.use(timeout(config.timeout));
-
-app.use(require('connect-livereload')({
- port: 35728,
- excludeList: ['.woff', '.flv']
-}));
-
-// Enable reverse proxy support in Express. This causes the
-// the "X-Forwarded-Proto" header field to be trusted so its
-// value can be used to determine the protocol. See
-// http://expressjs.com/api#app-settings for more details.
-app.enable('trust proxy');
-
-// Startup HTTP Server
-var httpServer = http.createServer(app);
-httpServer.listen(config.port);
-
-if (useSSL) {
- //
- // Supply `SSL_OP_NO_SSLv3` constant as secureOption to disable SSLv3
- // from the list of supported protocols that SSLv23_method supports.
- //
- var sslOptions = {};
- sslOptions['secureOptions'] = constants.SSL_OP_NO_SSLv3;
-
- sslOptions['key'] = fs.readFileSync(config.ssl.key);
- sslOptions['cert'] = fs.readFileSync(config.ssl.cert);
- sslOptions['ca'] = config.ssl.ca.map(function(cert){
- return fs.readFileSync(cert);
- });
-
- // Startup HTTPS Server
- var httpsServer = https.createServer(sslOptions, app);
- httpsServer.listen(config.sslPort);
-
- sslOptions.agent = new https.Agent(sslOptions);
-}
-
-console.log("Traffic Ops UI Port : %s", config.port);
-console.log("Traffic Ops UI Proxy Port : %s", config.proxyPort);
-console.log("Traffic Ops UI SSL Port : %s", config.sslPort);
[4/4] incubator-trafficcontrol git commit: This closes #445
Posted by de...@apache.org.
This closes #445
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c03453d8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c03453d8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c03453d8
Branch: refs/heads/master
Commit: c03453d8cd372546cb4e7a198ca06e101835e605
Parents: ad58176
Author: Dewayne Richardson <de...@apache.org>
Authored: Mon Apr 10 11:11:58 2017 -0600
Committer: Dewayne Richardson <de...@apache.org>
Committed: Mon Apr 10 11:11:58 2017 -0600
----------------------------------------------------------------------
----------------------------------------------------------------------
[3/4] incubator-trafficcontrol git commit: TO UI experimental no
longer uses express node.js server to run in prod mode - only in dev mode.
the http server you host it on in prod is up to you.
Posted by de...@apache.org.
TO UI experimental no longer uses express node.js server to run in prod mode - only in dev mode. the http server you host it on in prod is up to you.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f6e6afe4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f6e6afe4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f6e6afe4
Branch: refs/heads/master
Commit: f6e6afe4ed47e0e4ba3887f7faaf1c63e748249b
Parents: dd38873
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Fri Apr 7 12:26:14 2017 -0600
Committer: Dewayne Richardson <de...@apache.org>
Committed: Mon Apr 10 11:11:57 2017 -0600
----------------------------------------------------------------------
traffic_ops/experimental/ui/Gruntfile.js | 13 ++----
.../experimental/ui/app/src/scripts/config.js | 6 ++-
.../experimental/ui/conf/config-template.js | 49 --------------------
traffic_ops/experimental/ui/conf/config.js | 5 +-
traffic_ops/experimental/ui/grunt/copy.js | 18 -------
.../ui/grunt/install-dependencies.js | 25 ----------
traffic_ops/experimental/ui/grunt/ngconstant.js | 46 ------------------
traffic_ops/experimental/ui/package.json | 3 --
traffic_ops/experimental/ui/server/server.js | 39 ++++------------
9 files changed, 19 insertions(+), 185 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6e6afe4/traffic_ops/experimental/ui/Gruntfile.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/Gruntfile.js b/traffic_ops/experimental/ui/Gruntfile.js
index daeb4a0..a058e32 100644
--- a/traffic_ops/experimental/ui/Gruntfile.js
+++ b/traffic_ops/experimental/ui/Gruntfile.js
@@ -20,8 +20,6 @@
'use strict';
module.exports = function (grunt) {
- var os = require("os");
- var globalConfig = require('./grunt/globalConfig');
// load time grunt - helps with optimizing build times
require('time-grunt')(grunt);
@@ -29,25 +27,23 @@ module.exports = function (grunt) {
// load grunt task configurations
require('load-grunt-config')(grunt);
- // default task - runs in dev mode
+ // default task - when you type 'grunt' it really runs as 'grunt dev'
grunt.registerTask('default', ['dev']);
- // dev task - when you type 'grunt dev' <-- builds unminified app and starts express server
+ // dev task - when you type 'grunt dev' <-- builds unminified app and puts it in in app/dist folder and starts express server which reads server.js
grunt.registerTask('dev', [
'build-dev',
'express:dev',
'watch'
]);
- // dist task - when you type 'grunt dist' <-- builds minified app for distribution and generates node dependencies all wrapped up nicely in a /dist folder
+ // dist task - when you type 'grunt dist' <-- builds minified app for distribution all wrapped up nicely in app/dist folder
grunt.registerTask('dist', [
- 'build',
- 'install-dependencies'
+ 'build'
]);
// build tasks
grunt.registerTask('build', [
- 'ngconstant:prod',
'clean',
'copy:dist',
'build-css',
@@ -56,7 +52,6 @@ module.exports = function (grunt) {
]);
grunt.registerTask('build-dev', [
- 'ngconstant:dev',
'clean',
'copy:dev',
'build-css-dev',
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6e6afe4/traffic_ops/experimental/ui/app/src/scripts/config.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/app/src/scripts/config.js b/traffic_ops/experimental/ui/app/src/scripts/config.js
index 46606c9..19c2431 100644
--- a/traffic_ops/experimental/ui/app/src/scripts/config.js
+++ b/traffic_ops/experimental/ui/app/src/scripts/config.js
@@ -17,10 +17,12 @@
* under the License.
*/
+// this is the config the TO UI uses
+
"use strict";
- angular.module('config', [])
+angular.module('config', [])
-.constant('ENV', {api:{root:'/api/1.2/'}})
+.constant('ENV', { api: { root:'http://localhost:3000/api/1.2/' } })
;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6e6afe4/traffic_ops/experimental/ui/conf/config-template.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/conf/config-template.js b/traffic_ops/experimental/ui/conf/config-template.js
deleted file mode 100644
index 1a401cc..0000000
--- a/traffic_ops/experimental/ui/conf/config-template.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- */
-
-// this is the config for /opt/traffic_ops/server/server.js and is consumed when 'sudo service traffic_ops_v2 start'
-module.exports = {
- timeout: '120s',
- useSSL: false, // set to true if you plan to use https (self-signed or trusted certs).
- port: 8080,
- sslPort: 8443,
- proxyPort: 8009,
- // if useSSL is true, generate ssl certs and provide the proper locations.
- ssl: {
- key: '/path/to/ssl.key',
- cert: '/path/to/ssl.crt',
- ca: [
- '/path/to/ssl-bundle.crt'
- ]
- },
- // set api 'base_url' to the traffic ops url (all api calls made from the traffic ops ui will be proxied to the api base_url)
- // enter value for api 'key' if you want to append ?API_KEY=value to all api calls. It is suggested to leave blank.
- api: {
- base_url: 'http(s)://where-traffic-ops-is.com',
- key: ''
- },
- // default files location (this is where the traffic ops html, css and javascript was installed)
- files: {
- static: '/opt/traffic_ops_v2/public'
- },
- // default log location (this is where traffic_ops logs are written)
- log: {
- stream: '/var/log/traffic_ops_v2/access.log'
- },
- reject_unauthorized: 0 // 0 if using self-signed certs, 1 if trusted certs
-};
-
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6e6afe4/traffic_ops/experimental/ui/conf/config.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/conf/config.js b/traffic_ops/experimental/ui/conf/config.js
index 3d5c140..9666739 100644
--- a/traffic_ops/experimental/ui/conf/config.js
+++ b/traffic_ops/experimental/ui/conf/config.js
@@ -17,6 +17,7 @@
* under the License.
*/
+// this is the config that is consumed by server.js when running in dev mode
module.exports = {
timeout: '120s',
useSSL: false, // set to true if using ssl
@@ -30,10 +31,6 @@ module.exports = {
'/path/to/ssl-bundle.crt'
]
},
- api: {
- base_url: 'http://localhost:3000',
- key: ''
- },
files: {
static: './app/dist/public/'
},
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6e6afe4/traffic_ops/experimental/ui/grunt/copy.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/grunt/copy.js b/traffic_ops/experimental/ui/grunt/copy.js
index 34a0f66..0bc3d60 100644
--- a/traffic_ops/experimental/ui/grunt/copy.js
+++ b/traffic_ops/experimental/ui/grunt/copy.js
@@ -61,24 +61,6 @@ module.exports = {
{
expand: true,
dot: true,
- cwd: '<%= globalConfig.srcserverdir %>',
- dest: '<%= globalConfig.distdir %>/server',
- src: [
- 'server.js'
- ]
- },
- {
- expand: true,
- dot: true,
- cwd: '<%= globalConfig.srcdir %>',
- dest: '<%= globalConfig.distdir %>',
- src: [
- 'package.json'
- ]
- },
- {
- expand: true,
- dot: true,
cwd: '<%= globalConfig.srcdir %>',
dest: '<%= globalConfig.distdir %>/public',
src: [
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6e6afe4/traffic_ops/experimental/ui/grunt/install-dependencies.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/grunt/install-dependencies.js b/traffic_ops/experimental/ui/grunt/install-dependencies.js
deleted file mode 100644
index 14e96ac..0000000
--- a/traffic_ops/experimental/ui/grunt/install-dependencies.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-module.exports = {
- options: {
- cwd: '<%= globalConfig.distdir %>',
- isDevelopment: false
- }
-};
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6e6afe4/traffic_ops/experimental/ui/grunt/ngconstant.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/grunt/ngconstant.js b/traffic_ops/experimental/ui/grunt/ngconstant.js
deleted file mode 100644
index f8f0023..0000000
--- a/traffic_ops/experimental/ui/grunt/ngconstant.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-module.exports = {
- options: {
- space: ' ',
- wrap: '"use strict";\n\n {%= __ngModule %}',
- name: 'config',
- dest: '<%= globalConfig.srcdir %>/scripts/config.js'
- },
- dev: {
- constants: {
- ENV: {
- api: {
- "root": "/api/1.2/" // api base_url is defined in server.js
- }
- }
- }
- },
- prod: {
- constants: {
- ENV: {
- api: {
- "root": "/api/1.2/" // api base_url is defined in server.js
- }
- }
- }
- }
-};
-
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6e6afe4/traffic_ops/experimental/ui/package.json
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/package.json b/traffic_ops/experimental/ui/package.json
index 376e8f6..ec51762 100755
--- a/traffic_ops/experimental/ui/package.json
+++ b/traffic_ops/experimental/ui/package.json
@@ -9,7 +9,6 @@
"devDependencies": {
"morgan": "1.7.0",
"errorhandler": "1.4.3",
- "connect-modrewrite": "0.8.5",
"connect-timeout": "1.7.0",
"ssl-root-cas": "1.1.10",
"express": "4.13.4",
@@ -29,9 +28,7 @@
"grunt-contrib-watch": "0.6.1",
"grunt-express-server": "0.5.2",
"grunt-html2js": "0.3.5",
- "grunt-install-dependencies": "0.2.0",
"grunt-newer": "1.1.2",
- "grunt-ng-constant": "2.0.1",
"grunt-rev": "0.1.0",
"grunt-usemin": "3.0.0",
"grunt-wiredep": "2.0.0",
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f6e6afe4/traffic_ops/experimental/ui/server/server.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/server/server.js b/traffic_ops/experimental/ui/server/server.js
index c6d3b38..a6037eb 100644
--- a/traffic_ops/experimental/ui/server/server.js
+++ b/traffic_ops/experimental/ui/server/server.js
@@ -25,22 +25,11 @@ var constants = require('constants'),
fs = require('fs'),
morgan = require('morgan'),
errorhandler = require('errorhandler'),
- modRewrite = require('connect-modrewrite'),
timeout = require('connect-timeout');
-var config;
-
-try {
- // this should exist in prod environment. no need to create this file in dev as it will use the fallback (see catch)
- config = require('/etc/traffic_ops_v2/conf/config');
-}
-catch(e) {
- // this is used for dev environment
- config = require('../conf/config');
-}
-
-var logStream = fs.createWriteStream(config.log.stream, { flags: 'a' });
-var useSSL = config.useSSL;
+var config = require('../conf/config'),
+ logStream = fs.createWriteStream(config.log.stream, { flags: 'a' }),
+ useSSL = config.useSSL;
// Disable for self-signed certs in dev/test
process.env.NODE_TLS_REJECT_UNAUTHORIZED = config.reject_unauthorized;
@@ -60,10 +49,6 @@ app.all ("/*", function (req, res, next) {
}
});
-app.use(modRewrite([
- '^/api/(.*?)\\?(.*)$ ' + config.api.base_url + '/api/$1?$2&api_key=' + config.api.key + ' [P]', // match /api/{version}/foos?active=true and replace with api.base_url/api/{version}/foos?active=true&api_key=api.key
- '^/api/(.*)$ ' + config.api.base_url + '/api/$1?api_key=' + config.api.key + ' [P]' // match /api/{version}/foos and replace with api.base_url/api/{version}/foos?api_key=api.key
-]));
app.use(express.static(config.files.static));
app.use(morgan('combined', {
stream: logStream,
@@ -72,14 +57,10 @@ app.use(morgan('combined', {
app.use(errorhandler());
app.use(timeout(config.timeout));
-if (app.get('env') === 'dev') {
- app.use(require('connect-livereload')({
- port: 35728,
- excludeList: ['.woff', '.flv']
- }));
-} else {
- app.set('env', "production");
-}
+app.use(require('connect-livereload')({
+ port: 35728,
+ excludeList: ['.woff', '.flv']
+}));
// Enable reverse proxy support in Express. This causes the
// the "X-Forwarded-Proto" header field to be trusted so its
@@ -112,6 +93,6 @@ if (useSSL) {
sslOptions.agent = new https.Agent(sslOptions);
}
-console.log("Traffic Ops Port : %s", config.port);
-console.log("Traffic Ops Proxy Port : %s", config.proxyPort);
-console.log("Traffic Ops SSL Port : %s", config.sslPort);
+console.log("Traffic Ops UI Port : %s", config.port);
+console.log("Traffic Ops UI Proxy Port : %s", config.proxyPort);
+console.log("Traffic Ops UI SSL Port : %s", config.sslPort);