Generate nginx configs based on appid instead of location

Part of #37

This lets us not remember the old location (for removal)
This commit is contained in:
Girish Ramakrishnan
2014-08-23 12:04:50 -07:00
parent e9996d3eb2
commit f51f0ff56c
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -89,7 +89,7 @@ function configureNginx(app, callback) {
var sourceDir = path.resolve(__dirname, '..');
var nginxConf = ejs.render(NGINX_APPCONFIG_EJS, { sourceDir: sourceDir, vhost: appFqdn(app.location), port: freePort });
var nginxConfigFilename = path.join(config.nginxAppConfigDir, app.location + '.conf');
var nginxConfigFilename = path.join(config.nginxAppConfigDir, app.id + '.conf');
debug('writing config to ' + nginxConfigFilename);
fs.writeFile(nginxConfigFilename, nginxConf, function (error) {
@@ -106,7 +106,7 @@ function configureNginx(app, callback) {
}
function unconfigureNginx(app, callback) {
var nginxConfigFilename = path.join(config.nginxAppConfigDir, app.location + '.conf');
var nginxConfigFilename = path.join(config.nginxAppConfigDir, app.id + '.conf');
if (!safe.fs.unlinkSync(nginxConfigFilename)) {
console.error('Error removing nginx configuration ' + safe.error);
return callback(safe.error);
+2 -2
View File
@@ -63,7 +63,7 @@ describe('apptask', function () {
it('configure nginx correctly', function (done) {
apptask._configureNginx(APP, function (error) {
expect(fs.existsSync(config.nginxAppConfigDir + '/' + APP.location + '.conf'));
expect(fs.existsSync(config.nginxAppConfigDir + '/' + APP.id + '.conf'));
// expect(error).to.be(null); // this fails because nginx cannot be restarted
done();
});
@@ -71,7 +71,7 @@ describe('apptask', function () {
it('unconfigure nginx', function (done) {
apptask._unconfigureNginx(APP, function (error) {
expect(!fs.existsSync(config.nginxAppConfigDir + '/' + APP.location + '.conf'));
expect(!fs.existsSync(config.nginxAppConfigDir + '/' + APP.id + '.conf'));
// expect(error).to.be(null); // this fails because nginx cannot be restarted
done();
});