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:
3
.github/workflows/e2e-tests.yml
vendored
3
.github/workflows/e2e-tests.yml
vendored
@@ -32,6 +32,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
run: npm run ci
|
run: npm run ci
|
||||||
|
env:
|
||||||
|
# Needed since we use next start which will set the NODE_ENV to production
|
||||||
|
NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH: './example/cert.p12'
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
@@ -28,9 +28,18 @@ export const signWithLocalCert = async ({ pdf }: SignWithLocalCertOptions) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!cert) {
|
if (!cert) {
|
||||||
cert = Buffer.from(
|
let certPath = process.env.NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH || '/opt/documenso/cert.p12';
|
||||||
fs.readFileSync(process.env.NEXT_PRIVATE_SIGNING_LOCAL_FILE_PATH || './example/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({
|
const signature = signWithP12({
|
||||||
|
|||||||
Reference in New Issue
Block a user