2016-06-22 11:22:09 +00:00
|
|
|
import * as plugins from "./cert.plugins";
|
2016-06-18 13:59:03 +00:00
|
|
|
import * as paths from "./cert.paths";
|
|
|
|
|
|
|
|
export class Cert {
|
|
|
|
cfEmail:string;
|
|
|
|
cfKey:string;
|
|
|
|
sslDir:string;
|
|
|
|
certificatesPresent;
|
|
|
|
certificatesValid;
|
|
|
|
gitOriginRepo;
|
|
|
|
constructor(optionsArg:{
|
|
|
|
cfEmail:string,
|
|
|
|
cfKey:string,
|
|
|
|
sslDir:string,
|
2016-06-21 18:02:57 +00:00
|
|
|
gitOriginRepo?:string
|
2016-06-18 13:59:03 +00:00
|
|
|
}){
|
|
|
|
this.cfEmail = optionsArg.cfEmail;
|
|
|
|
this.cfKey = optionsArg.cfKey;
|
|
|
|
this.sslDir = optionsArg.sslDir;
|
|
|
|
this.gitOriginRepo = optionsArg.gitOriginRepo;
|
2016-06-22 11:22:09 +00:00
|
|
|
let config = {
|
|
|
|
cfEmail: this.cfEmail,
|
|
|
|
cfKey: this.cfKey
|
|
|
|
}
|
|
|
|
plugins.smartfile.memory.toFsSync(JSON.stringify(config),{fileName:"config.json",filePath:plugins.path.join(__dirname,"assets/")});
|
|
|
|
};
|
|
|
|
getDomainCert(domainNameArg:string){
|
|
|
|
let done = plugins.q.defer();
|
|
|
|
plugins.shelljs.exec("chmod 700 " + paths.letsencryptSh);
|
|
|
|
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 + "\"");
|
|
|
|
done.resolve();
|
|
|
|
return done.promise;
|
2016-06-18 13:59:03 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-06-22 11:55:38 +00:00
|
|
|
class Certificate {
|
2016-06-21 18:02:57 +00:00
|
|
|
domainName:string;
|
|
|
|
creationDate:Date;
|
|
|
|
expiryDate:Date;
|
2016-06-18 13:59:03 +00:00
|
|
|
constructor(){
|
|
|
|
|
|
|
|
};
|
2016-06-22 11:55:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
let updateSslDir = () => {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
let updateGitOrigin = () => {
|
|
|
|
|
2016-06-18 13:59:03 +00:00
|
|
|
}
|