mirror of
https://github.com/sys-32Dev/register.git
synced 2026-08-08 20:06:34 +00:00
fixes certbot script
This commit is contained in:
@@ -3,7 +3,7 @@ let
|
||||
inherit (nixpkgs) pkgs;
|
||||
|
||||
nixPackages = with pkgs; [
|
||||
nodejs-15_x
|
||||
nodejs-16_x
|
||||
yarn
|
||||
docker-compose
|
||||
dnsutils
|
||||
|
||||
@@ -32,16 +32,28 @@ update_record() {
|
||||
echo "
|
||||
const { domainService } = require('./utils/domain-service');
|
||||
const { ENV, DOMAIN_DOMAIN } = require('./utils/constants');
|
||||
const record = {
|
||||
name: '$name',
|
||||
type: '$type',
|
||||
address: '$address',
|
||||
ttl: $ttl,
|
||||
};
|
||||
console.log('Uploading $name to', DOMAIN_DOMAIN, '(', ENV, ')...');
|
||||
domainService.$method(record)()
|
||||
.then(d => console.log(d.cpanelresult ? d.cpanelresult.data : d))
|
||||
.catch(console.error);
|
||||
const method = '$method';
|
||||
const name = '$name';
|
||||
const type = '$type';
|
||||
|
||||
const record = { name, type, address: '$address', ttl: $ttl };
|
||||
|
||||
async function main() {
|
||||
if (method === 'removeZoneRecord') {
|
||||
const data = await domainService.get({ customonly: 0, name: '$name.is-a.dev.', type });
|
||||
if (data.length > 0) {
|
||||
record.id = data[0].line;
|
||||
} else {
|
||||
throw new Error('Unable to find record');
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Uploading $name to', DOMAIN_DOMAIN, '(', ENV, ')...');
|
||||
const data = await domainService[method](record)();
|
||||
console.log(data.cpanelresult ? data.cpanelresult.data : data);
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
" | node -
|
||||
}
|
||||
|
||||
|
||||
@@ -95,13 +95,13 @@ const getDomainService = ({ cpanel }) => {
|
||||
Promise.all([fetchZoneRecords(), fetchRedirections()]).then(R.flatten);
|
||||
|
||||
const addRecords = R.compose(batchLazyTasks(BATCH_SIZE), R.filter(Boolean), R.map(R.cond([
|
||||
[ R.propEq('name', 'www'), R.always(null) ], // Ignore www
|
||||
[ R.propEq('type', 'URL'), addRedirection ],
|
||||
[ R.T, addZoneRecord ],
|
||||
[R.propEq('name', 'www'), R.always(null)], // Ignore www
|
||||
[R.propEq('type', 'URL'), addRedirection],
|
||||
[R.T, addZoneRecord],
|
||||
])));
|
||||
const removeRecords = R.compose(batchLazyTasks(BATCH_SIZE), R.map(R.cond([
|
||||
[ R.propEq('type', 'URL'), removeRedirection ],
|
||||
[ R.T, removeZoneRecord ],
|
||||
[R.propEq('type', 'URL'), removeRedirection],
|
||||
[R.T, removeZoneRecord],
|
||||
])));
|
||||
|
||||
const updateHosts = async hosts => {
|
||||
@@ -115,7 +115,7 @@ const getDomainService = ({ cpanel }) => {
|
||||
return { added: add.length, removed: remove.length };
|
||||
};
|
||||
|
||||
return { getHosts, addZoneRecord, removeZoneRecord, updateHosts };
|
||||
return { getHosts, get: cpanel.zone.fetch, addZoneRecord, removeZoneRecord, updateHosts };
|
||||
};
|
||||
|
||||
const domainService = getDomainService({ cpanel });
|
||||
|
||||
Reference in New Issue
Block a user