start implementing validity check

This commit is contained in:
Philipp Kunz 2016-06-23 03:46:37 +02:00
parent 5c87851ab8
commit 645e46dc01

View File

@ -24,12 +24,17 @@ export class Cert {
} }
plugins.smartfile.memory.toFsSync(JSON.stringify(config), { fileName: "config.json", filePath: plugins.path.join(__dirname, "assets/") }); plugins.smartfile.memory.toFsSync(JSON.stringify(config), { fileName: "config.json", filePath: plugins.path.join(__dirname, "assets/") });
}; };
getDomainCert(domainNameArg:string){ getDomainCert(domainNameArg: string,optionsArg:{force:boolean}) {
let done = plugins.q.defer(); let done = plugins.q.defer();
if (!checkDomainStillValid(domainNameArg) || optionsArg.force) {
plugins.shelljs.exec("chmod 700 " + paths.letsencryptSh); plugins.shelljs.exec("chmod 700 " + paths.letsencryptSh);
plugins.shelljs.exec("chmod 700 " + paths.certHook); plugins.shelljs.exec("chmod 700 " + paths.certHook);
plugins.shelljs.exec("bash -c \"" + paths.letsencryptSh + " -c -d " + domainNameArg + " -t dns-01 -k " + paths.certHook + " -o " + paths.sslDir + "\""); plugins.shelljs.exec("bash -c \"" + paths.letsencryptSh + " -c -d " + domainNameArg + " -t dns-01 -k " + paths.certHook + " -o " + paths.sslDir + "\"");
done.resolve(); done.resolve();
} else {
plugins.beautylog.info("certificate for " + domainNameArg + " is still valid! Not fetching new one!");
done.resolve();
}
return done.promise; return done.promise;
}; };
} }
@ -43,6 +48,10 @@ class Certificate {
}; };
} }
let checkDomainStillValid = (domainNameArg: string): boolean => {
return false;
}
let updateSslDir = () => { let updateSslDir = () => {
} }