Skip to content

Commit f7e520d

Browse files
committed
fix: correctly access internal certs from compiled sources
closes #163
1 parent 6d9a6c8 commit f7e520d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/ssl-credentials.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import {Logger} from './logging';
33
import fs from 'fs';
44
import path from 'path';
5+
import {getRelTopLevelPath} from "./version";
56

6-
const FALLBACK_INTERNAL_ROOT_CERTS = path.join(__dirname, '../certs/internal.pem');
7-
const FALLBACK_SYSTEM_ROOT_CERTS = path.join(__dirname, '../certs/system.pem');
7+
const FALLBACK_INTERNAL_ROOT_CERTS = path.join(__dirname, getRelTopLevelPath(), 'certs/internal.pem');
8+
const FALLBACK_SYSTEM_ROOT_CERTS = path.join(__dirname, getRelTopLevelPath(), 'certs/system.pem');
89

910
function makeInternalRootCertificates() {
1011
const internalRootCertificates = fs.readFileSync(FALLBACK_INTERNAL_ROOT_CERTS);

src/version.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
const pkgPath = process.env.TEST_ENVIRONMENT === 'dev' ? '../package.json' : '../../package.json';
2-
const pkgInfo = require(pkgPath);
1+
import path from 'path';
2+
3+
export function getRelTopLevelPath() {
4+
return process.env.TEST_ENVIRONMENT === 'dev' ? '..' : '../..';
5+
}
6+
7+
const pkgInfo = require(path.join(getRelTopLevelPath(), 'package.json'));
38

49
function getVersion() {
510
return pkgInfo.version;

0 commit comments

Comments
 (0)