Asterisk to allow all zones
gitea/docker-discover/pipeline/head This commit looks good
Details
gitea/docker-discover/pipeline/head This commit looks good
Details
This commit is contained in:
parent
7907f7c363
commit
25bc1e2b37
|
@ -33,9 +33,7 @@ acls:
|
|||
sysadmin:
|
||||
ips:
|
||||
- 10.5.1.0/24
|
||||
zones:
|
||||
- dmz
|
||||
- it
|
||||
zones: *
|
||||
defaults:
|
||||
https: true
|
||||
zone: public
|
||||
|
|
23
index.js
23
index.js
|
@ -154,12 +154,13 @@ async function updateProxy(firstRun) {
|
|||
console.log('Saved settings hash:', lastInfoHash);
|
||||
}
|
||||
|
||||
// Fetch backends
|
||||
|
||||
const hostMap = [];
|
||||
const baseMap = [];
|
||||
const https = [];
|
||||
const zoneMap = [];
|
||||
const aclMap = [];
|
||||
const accessMap = [];
|
||||
const zones = new Set();
|
||||
|
||||
for (const domain in conf.domains) {
|
||||
const domainConf = conf.domains[domain];
|
||||
|
@ -181,8 +182,10 @@ async function updateProxy(firstRun) {
|
|||
|
||||
if (serviceConf.https)
|
||||
https.push(service);
|
||||
if (serviceConf.zone)
|
||||
if (serviceConf.zone) {
|
||||
zoneMap.push([service, serviceConf.zone]);
|
||||
zones.add(serviceConf.zone);
|
||||
}
|
||||
|
||||
rules = rules || serviceConf.rules;
|
||||
|
||||
|
@ -215,19 +218,26 @@ async function updateProxy(firstRun) {
|
|||
}
|
||||
}
|
||||
|
||||
// Fetch ACLs
|
||||
|
||||
const aclMap = [];
|
||||
const acls = [];
|
||||
|
||||
for (const acl in conf.acls) {
|
||||
const aclConf = conf.acls[acl];
|
||||
|
||||
const ips = [];
|
||||
for (const ip of aclConf.ips) {
|
||||
aclMap.push([ip, acl]);
|
||||
ips.push(parseNet(ip));
|
||||
}
|
||||
|
||||
acls.push({
|
||||
name: acl,
|
||||
ips,
|
||||
zones: new Set(aclConf.zones)
|
||||
zones: aclConf.zones === '*'
|
||||
? new Set(zones)
|
||||
: new Set(aclConf.zones)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -260,10 +270,13 @@ async function updateProxy(firstRun) {
|
|||
}
|
||||
}}}
|
||||
|
||||
const accessMap = [];
|
||||
for (const acl of acls)
|
||||
for (const zone of acl.zones)
|
||||
accessMap.push(`${acl.name}/${zone}`);
|
||||
|
||||
// Generate maps
|
||||
|
||||
const files = {
|
||||
host: hostMap,
|
||||
base: baseMap,
|
||||
|
@ -303,6 +316,8 @@ async function updateProxy(firstRun) {
|
|||
await fs.close(fd);
|
||||
}
|
||||
|
||||
// Initalize
|
||||
|
||||
await updateProxy(true);
|
||||
|
||||
console.log('Listening for events.')
|
||||
|
|
Reference in New Issue