mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
feat: reload nginx on proxyconfig change
This commit is contained in:
22
src/main.ts
22
src/main.ts
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 StApps
|
||||
* Copyright (C) 2022 StApps
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
@@ -21,7 +21,7 @@ import {join} from 'path';
|
||||
import * as semver from 'semver';
|
||||
import {
|
||||
asyncReadFile,
|
||||
configFile,
|
||||
ConfigFile,
|
||||
isFileType,
|
||||
protocolHardeningParameters,
|
||||
SSLFilePaths,
|
||||
@@ -107,7 +107,7 @@ export async function generateUpstreamMap(
|
||||
}
|
||||
|
||||
if (activeBackends.length !== 0) {
|
||||
// not only dublicates
|
||||
// not only duplicates
|
||||
foundMatchingContainer = true;
|
||||
|
||||
const gateWayOfContainer = await getGatewayOfStAppsBackend(activeBackends[0]);
|
||||
@@ -156,12 +156,12 @@ export function generateListener(sslFilePaths: SSLFilePaths) {
|
||||
typeof sslFilePaths.dhparam !== 'undefined' && isFileType(sslFilePaths.dhparam,'pem')
|
||||
) {
|
||||
// https listener
|
||||
listener = `listen 443 ssl default_server;
|
||||
ssl_certificate ${sslFilePaths.certificate};
|
||||
ssl_certificate_key ${sslFilePaths.certificateKey};
|
||||
ssl_trusted_certificate ${sslFilePaths.certificateChain};
|
||||
ssl_dhparam ${sslFilePaths.dhparam};
|
||||
${sslHardeningParameters}`;
|
||||
listener = ` listen 443 ssl default_server;
|
||||
ssl_certificate ${sslFilePaths.certificate};
|
||||
ssl_certificate_key ${sslFilePaths.certificateKey};
|
||||
ssl_trusted_certificate ${sslFilePaths.certificateChain};
|
||||
ssl_dhparam ${sslFilePaths.dhparam};
|
||||
${sslHardeningParameters}`;
|
||||
} else {
|
||||
// default http listener
|
||||
listener = 'listen 80 default_server;';
|
||||
@@ -205,6 +205,10 @@ function generateRateLimitAllowList(entries: string[]): string {
|
||||
* @param containers List of container info
|
||||
*/
|
||||
export async function getTemplateView(containers: Dockerode.ContainerInfo[]): Promise<TemplateView> {
|
||||
delete require.cache[require.resolve('config')];
|
||||
const config = require('config');
|
||||
const configFile = config as ConfigFile;
|
||||
|
||||
const cors = await asyncReadFile('./fixtures/cors.template', 'utf8');
|
||||
|
||||
const visibleRoutesPromises = ['/'].map(async (route) => {
|
||||
|
||||
Reference in New Issue
Block a user