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:
+2
-2
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user