start implementing validity check
This commit is contained in:
parent
5c87851ab8
commit
645e46dc01
51
ts/index.ts
51
ts/index.ts
@ -2,18 +2,18 @@ import * as plugins from "./cert.plugins";
|
|||||||
import * as paths from "./cert.paths";
|
import * as paths from "./cert.paths";
|
||||||
|
|
||||||
export class Cert {
|
export class Cert {
|
||||||
cfEmail:string;
|
cfEmail: string;
|
||||||
cfKey:string;
|
cfKey: string;
|
||||||
sslDir:string;
|
sslDir: string;
|
||||||
certificatesPresent;
|
certificatesPresent;
|
||||||
certificatesValid;
|
certificatesValid;
|
||||||
gitOriginRepo;
|
gitOriginRepo;
|
||||||
constructor(optionsArg:{
|
constructor(optionsArg: {
|
||||||
cfEmail:string,
|
cfEmail: string,
|
||||||
cfKey:string,
|
cfKey: string,
|
||||||
sslDir:string,
|
sslDir: string,
|
||||||
gitOriginRepo?:string
|
gitOriginRepo?: string
|
||||||
}){
|
}) {
|
||||||
this.cfEmail = optionsArg.cfEmail;
|
this.cfEmail = optionsArg.cfEmail;
|
||||||
this.cfKey = optionsArg.cfKey;
|
this.cfKey = optionsArg.cfKey;
|
||||||
this.sslDir = optionsArg.sslDir;
|
this.sslDir = optionsArg.sslDir;
|
||||||
@ -22,31 +22,40 @@ export class Cert {
|
|||||||
cfEmail: this.cfEmail,
|
cfEmail: this.cfEmail,
|
||||||
cfKey: this.cfKey
|
cfKey: this.cfKey
|
||||||
}
|
}
|
||||||
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();
|
||||||
plugins.shelljs.exec("chmod 700 " + paths.letsencryptSh);
|
if (!checkDomainStillValid(domainNameArg) || optionsArg.force) {
|
||||||
plugins.shelljs.exec("chmod 700 " + paths.certHook);
|
plugins.shelljs.exec("chmod 700 " + paths.letsencryptSh);
|
||||||
plugins.shelljs.exec("bash -c \"" + paths.letsencryptSh + " -c -d " + domainNameArg + " -t dns-01 -k " + paths.certHook + " -o "+ paths.sslDir + "\"");
|
plugins.shelljs.exec("chmod 700 " + paths.certHook);
|
||||||
done.resolve();
|
plugins.shelljs.exec("bash -c \"" + paths.letsencryptSh + " -c -d " + domainNameArg + " -t dns-01 -k " + paths.certHook + " -o " + paths.sslDir + "\"");
|
||||||
|
done.resolve();
|
||||||
|
} else {
|
||||||
|
plugins.beautylog.info("certificate for " + domainNameArg + " is still valid! Not fetching new one!");
|
||||||
|
done.resolve();
|
||||||
|
}
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class Certificate {
|
class Certificate {
|
||||||
domainName:string;
|
domainName: string;
|
||||||
creationDate:Date;
|
creationDate: Date;
|
||||||
expiryDate:Date;
|
expiryDate: Date;
|
||||||
constructor(){
|
constructor() {
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let updateSslDir = () => {
|
let checkDomainStillValid = (domainNameArg: string): boolean => {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let updateSslDir = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let updateGitOrigin = () => {
|
let updateGitOrigin = () => {
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user