@@ -55,11 +55,10 @@ export function humanPath(p?: string): string {
5555}
5656
5757export const generateCertificate = async ( ) : Promise < { cert : string ; certKey : string } > => {
58- const paths = {
59- cert : path . join ( tmpdir , "self-signed.cert" ) ,
60- certKey : path . join ( tmpdir , "self-signed.key" ) ,
61- }
62- const checks = await Promise . all ( [ fs . pathExists ( paths . cert ) , fs . pathExists ( paths . certKey ) ] )
58+ const certPath = path . join ( paths . data , "self-signed.cert" )
59+ const certKeyPath = path . join ( paths . data , "self-signed.key" )
60+
61+ const checks = await Promise . all ( [ fs . pathExists ( certPath ) , fs . pathExists ( certKeyPath ) ] )
6362 if ( ! checks [ 0 ] || ! checks [ 1 ] ) {
6463 // Require on demand so openssl isn't required if you aren't going to
6564 // generate certificates.
@@ -69,10 +68,13 @@ export const generateCertificate = async (): Promise<{ cert: string; certKey: st
6968 return error ? reject ( error ) : resolve ( result )
7069 } )
7170 } )
72- await fs . mkdirp ( tmpdir )
73- await Promise . all ( [ fs . writeFile ( paths . cert , certs . certificate ) , fs . writeFile ( paths . certKey , certs . serviceKey ) ] )
71+ await fs . mkdirp ( paths . data )
72+ await Promise . all ( [ fs . writeFile ( certPath , certs . certificate ) , fs . writeFile ( certKeyPath , certs . serviceKey ) ] )
73+ }
74+ return {
75+ cert : certPath ,
76+ certKey : certKeyPath ,
7477 }
75- return paths
7678}
7779
7880export const generatePassword = async ( length = 24 ) : Promise < string > => {
0 commit comments