Skip to content

Commit

Permalink
Handle more things in migrator
Browse files Browse the repository at this point in the history
  • Loading branch information
Rush committed Nov 29, 2014
1 parent e8be5a7 commit 8013035
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions migrateV1Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,25 @@ module.exports = function(argv, data, cb) {
config.middleware.push(
'gzip -> 9'
);
delete config.gzip;
}
delete config.gzip;
Object.keys(config.ports).forEach(function(port) {

var portConfig = config.ports[port];
if(portConfig.gzip) {
config.ports[port] = ['gzip -> 9', portConfig];
}
delete portConfig.gzip;

portConfig.router = portConfig.router || {};

function migrateEntries(name) {
Object.keys(portConfig[name]).forEach(function(key) {
var portConfigEntry = portConfig[name][key];
if(name !== 'proxy')
portConfigEntry = name + " -> " + portConfigEntry.toString();
if(name === 'proxy' && portConfigEntry.auth) {
portConfigEntry = ['auth -> ' + portConfigEntry.auth, portConfigEntry.target];
}
portConfig.router[key] = portConfigEntry;
});
}
Expand All @@ -48,6 +55,10 @@ module.exports = function(argv, data, cb) {
migrateEntries('reject');
delete portConfig.reject;
}
if(portConfig.static) {
migrateEntries('static');
delete portConfig.static;
}
if(portConfig.redirect) {
migrateEntries('redirect');
delete portConfig.redirect;
Expand Down

0 comments on commit 8013035

Please sign in to comment.