Updated generator to read parent env config
diff --git a/views/ngXosViews/truckroll/env/default.js b/views/ngXosViews/truckroll/env/default.js
deleted file mode 100644
index 3cb3cc2..0000000
--- a/views/ngXosViews/truckroll/env/default.js
+++ /dev/null
@@ -1,13 +0,0 @@
-// This is a default configuration for your development environment.
-// You can duplicate this configuration for any of your Backend Environments.
-// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
-// `NODE_ENV=local npm start`
-//
-// If xoscsrftoken or xossessionid are not specified the browser value are used
-// (works only for local environment as both application are served on the same domain)
-
-module.exports = {
- host: 'http://xos.dev:9999/',
- xoscsrftoken: 'AJkHTtR8zZi8UAZsH7RjEj6qvvV8DjAL',
- xossessionid: '1mtzd7n9l3qkck4hc8tmuii491ovg07w'
-};
diff --git a/views/ngXosViews/truckroll/gulp/server.js b/views/ngXosViews/truckroll/gulp/server.js
index c0678d9..1e40a34 100644
--- a/views/ngXosViews/truckroll/gulp/server.js
+++ b/views/ngXosViews/truckroll/gulp/server.js
@@ -10,18 +10,24 @@
var httpProxy = require('http-proxy');
var del = require('del');
var sass = require('gulp-sass');
+var fs = require('fs');
+var path = require('path');
const environment = process.env.NODE_ENV;
-if (environment){
- var conf = require(`../env/${environment}.js`);
-}
-else{
- var conf = require('../env/default.js')
+if(!fs.existsSync(path.join(__dirname, `../../../env/${environment || 'default'}.js`))){
+ if(!environment){
+ throw new Error('You should define a default.js config in /views/env folder.');
+ }
+ else{
+ throw new Error(`Since you are loading a custom environment, you should define a ${environment}.js config in /views/env folder.`);
+ }
}
+var conf = require(path.join(__dirname, `../../../env/${environment || 'default'}.js`));
+
var proxy = httpProxy.createProxyServer({
- target: conf.host || 'http://0.0.0.0:9999'
+ target: conf.host
});
@@ -51,10 +57,6 @@
},
middleware: function(req, res, next){
if(
- // to be removed, deprecated API
- // req.url.indexOf('/xos/') !== -1 ||
- // req.url.indexOf('/xoslib/') !== -1 ||
- // req.url.indexOf('/hpcapi/') !== -1 ||
req.url.indexOf('/api/') !== -1
){
if(conf.xoscsrftoken && conf.xossessionid){
diff --git a/views/ngXosViews/truckroll/spec/sample.test.js b/views/ngXosViews/truckroll/spec/sample.test.js
index 06ebc1b..52ebe84 100644
--- a/views/ngXosViews/truckroll/spec/sample.test.js
+++ b/views/ngXosViews/truckroll/spec/sample.test.js
@@ -26,7 +26,7 @@
isolatedScope = element.isolateScope().vm;
}));
- it('should load 1 users', () => {
+ it('should load 1 subscriber', () => {
httpBackend.flush();
expect(isolatedScope.subscribers.length).toBe(1);
});
diff --git a/views/ngXosViews/truckroll/src/templates/users-list.tpl.html b/views/ngXosViews/truckroll/src/templates/users-list.tpl.html
deleted file mode 100644
index 1fee0e2..0000000
--- a/views/ngXosViews/truckroll/src/templates/users-list.tpl.html
+++ /dev/null
@@ -1 +0,0 @@
-<xos-table config="vm.tableConfig" data="vm.users"></xos-table>
\ No newline at end of file