File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -31,12 +31,14 @@ export class PersistentCertCache {
3131 certFiles . map ( f => `'${ f } '` ) . join ( ', ' )
3232 } `) ;
3333
34- await Promise . all ( certFiles . map ( async ( certPath ) => {
35- if ( ! certPath . endsWith ( '.cert.json' ) ) {
36- console . log ( `Unexpected file in cert dir: ${ certPath } ` ) ;
34+ await Promise . all ( certFiles . map ( async ( certName ) => {
35+ if ( ! certName . endsWith ( '.cert.json' ) ) {
36+ console . log ( `Unexpected file in cert dir: ${ certName } ` ) ;
3737 return ;
3838 }
3939
40+ const certPath = path . join ( this . certCacheDir , certName ) ;
41+
4042 try {
4143 const data = JSON . parse (
4244 ( await fs . readFile ( certPath ) ) . toString ( 'utf8' )
@@ -51,13 +53,16 @@ export class PersistentCertCache {
5153
5254 this . cache [ data . domain ] = data ;
5355 } catch ( e ) {
54- console . log ( `Could not load cert from ${ certPath } :` , e ) ;
56+ console . log ( `Could not load cert from ${ certName } :` , e ) ;
5557 }
5658 } ) ) ;
5759 }
5860
5961 cacheCert ( cert : CachedCertificate ) : CachedCertificate | undefined {
6062 const { domain } = cert ;
63+
64+ this . cache [ domain ] = cert ;
65+
6166 fs . writeFile (
6267 path . join ( this . certCacheDir , `${ domain } .cert.json` ) ,
6368 JSON . stringify ( cert )
You can’t perform that action at this time.
0 commit comments