2015-12-10 20:31:38 -08:00
|
|
|
/* global it:false */
|
|
|
|
|
/* global describe:false */
|
|
|
|
|
/* global before:false */
|
|
|
|
|
/* global after:false */
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2026-01-17 13:38:17 +01:00
|
|
|
const common = require('./common.js'),
|
2018-01-31 18:37:08 +01:00
|
|
|
domains = require('../domains.js'),
|
2016-06-22 13:48:07 -05:00
|
|
|
expect = require('expect.js'),
|
2025-08-14 11:17:38 +05:30
|
|
|
fs = require('node:fs'),
|
2021-06-03 12:20:44 -07:00
|
|
|
paths = require('../paths.js'),
|
2026-01-17 13:38:17 +01:00
|
|
|
reverseProxy = require('../reverseproxy.js');
|
2021-06-03 12:20:44 -07:00
|
|
|
|
2021-08-13 17:22:28 -07:00
|
|
|
describe('Reverse Proxy', function () {
|
2022-11-28 21:23:06 +01:00
|
|
|
const { setup, cleanup, domain, auditSource, app } = common;
|
2021-08-13 10:41:10 -07:00
|
|
|
const domainCopy = Object.assign({}, domain);
|
|
|
|
|
|
|
|
|
|
before(setup);
|
|
|
|
|
after(cleanup);
|
2021-06-03 12:20:44 -07:00
|
|
|
|
|
|
|
|
describe('configureApp', function () {
|
2021-08-13 17:22:28 -07:00
|
|
|
before(async function () {
|
2021-08-13 10:41:10 -07:00
|
|
|
domainCopy.tlsConfig = { provider: 'fallback' };
|
2021-06-03 16:16:04 -07:00
|
|
|
|
2021-12-03 13:46:54 -08:00
|
|
|
await domains.setConfig(domainCopy.domain, domainCopy, auditSource);
|
2021-06-03 16:16:04 -07:00
|
|
|
});
|
|
|
|
|
|
2021-08-17 14:04:29 -07:00
|
|
|
it('configure nginx correctly', async function () {
|
|
|
|
|
await reverseProxy.configureApp(app, auditSource);
|
|
|
|
|
expect(fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + app.id + '.conf'));
|
2021-06-03 12:20:44 -07:00
|
|
|
});
|
|
|
|
|
|
2021-08-17 14:04:29 -07:00
|
|
|
it('unconfigure nginx', async function () {
|
|
|
|
|
await reverseProxy.unconfigureApp(app);
|
|
|
|
|
expect(!fs.existsSync(paths.NGINX_APPCONFIG_DIR + '/' + app.id + '.conf'));
|
2021-06-03 12:20:44 -07:00
|
|
|
});
|
|
|
|
|
});
|
2015-12-10 20:31:38 -08:00
|
|
|
});
|