Skip to content

Commit 1eaff43

Browse files
committed
fix: fix types checks errors
1 parent 0262b61 commit 1eaff43

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/config/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ function mergeConfigurations(
8181
// If user doesn't specify tls but has legacy SSL fields, use only legacy fallback
8282
if (!userSettings.tls && (userSettings.sslKeyPemPath || userSettings.sslCertPemPath)) {
8383
tlsConfig = {
84-
...defaultConfig.tls,
85-
// Clear the default key/cert paths so legacy fallback works
86-
key: undefined as any,
87-
cert: undefined as any,
84+
enabled: defaultConfig.tls?.enabled || false,
85+
// Use empty strings so legacy fallback works
86+
key: '',
87+
cert: '',
8888
};
8989
}
9090

@@ -257,12 +257,12 @@ export const getPlugins = () => {
257257

258258
export const getTLSKeyPemPath = (): string | undefined => {
259259
const config = loadFullConfiguration();
260-
return config.tls?.key || config.sslKeyPemPath;
260+
return (config.tls?.key && config.tls.key !== '') ? config.tls.key : config.sslKeyPemPath;
261261
};
262262

263263
export const getTLSCertPemPath = (): string | undefined => {
264264
const config = loadFullConfiguration();
265-
return config.tls?.cert || config.sslCertPemPath;
265+
return (config.tls?.cert && config.tls.cert !== '') ? config.tls.cert : config.sslCertPemPath;
266266
};
267267

268268
export const getTLSEnabled = (): boolean => {

src/proxy/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const options: ServerOptions = {
3030
inflate: true,
3131
limit: '100000kb',
3232
type: '*/*',
33-
key: getTLSEnabled() ? fs.readFileSync(getTLSKeyPemPath()) : undefined,
34-
cert: getTLSEnabled() ? fs.readFileSync(getTLSCertPemPath()) : undefined,
33+
key: getTLSEnabled() && getTLSKeyPemPath() ? fs.readFileSync(getTLSKeyPemPath()!) : undefined,
34+
cert: getTLSEnabled() && getTLSCertPemPath() ? fs.readFileSync(getTLSCertPemPath()!) : undefined,
3535
};
3636

3737
export const proxyPreparations = async () => {

src/proxy/routes/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ router.use(teeAndValidate);
113113

114114
router.use(
115115
'/',
116-
proxy(getProxyUrl(), {
116+
proxy(getProxyUrl() || '', {
117117
parseReqBody: false,
118118
preserveHostHdr: false,
119119

0 commit comments

Comments
 (0)