fix: changed the default file path for local certs (#1277)

Changed the default value of NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH env
variable
This commit is contained in:
Imran Khan
2024-09-06 09:39:25 +05:30
committed by GitHub
parent bdc4ec1a31
commit a6f93698b4
2 changed files with 15 additions and 3 deletions

View File

@ -28,9 +28,18 @@ export const signWithLocalCert = async ({ pdf }: SignWithLocalCertOptions) => {
}
if (!cert) {
cert = Buffer.from(
fs.readFileSync(process.env.NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH || './example/cert.p12'),
);
let certPath = process.env.NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH || '/opt/documenso/cert.p12';
// We don't want to make the development server suddenly crash when using the `dx` script
// so we retain this when NODE_ENV isn't set to production which it should be in most production
// deployments.
//
// Our docker image automatically sets this so it shouldn't be an issue for self-hosters.
if (process.env.NODE_ENV !== 'production') {
certPath = process.env.NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH || './example/cert.p12';
}
cert = Buffer.from(fs.readFileSync(certPath));
}
const signature = signWithP12({