Skip to content

Commit

Permalink
fix: return proxy server
Browse files Browse the repository at this point in the history
  • Loading branch information
agerard-godaddy committed Nov 26, 2024
1 parent bca7b47 commit 820d46a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/gasket-plugin-https-proxy/lib/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function startProxyServer(gasket) {
const opts = await gasket.execWaterfall('httpsProxy', httpsProxy);

const { protocol = 'http', hostname = 'localhost', port = 8080, ...proxyOpts } = opts;
proxy.createServer(
const server = proxy.createServer(
proxyOpts
).on('error', (err) => {
logger.error('Request failed to proxy:', err);
Expand All @@ -19,6 +19,7 @@ export async function startProxyServer(gasket) {
);

logger.info(`Proxy server started: ${protocol}://${hostname}:${port}`);
return server;
}

export const actions = {
Expand Down
5 changes: 3 additions & 2 deletions packages/gasket-plugin-https-proxy/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Plugin } from '@gasket/core';
import type { ServerOptions as ProxyServerOptions } from 'http-proxy';
import type { ServerOptions as ProxyServerOptions, Server as ProxyServer } from 'http-proxy';
import http from 'http';

interface BaseHttpsProxyConfig extends ProxyServerOptions {
protocol?: string;
Expand All @@ -21,7 +22,7 @@ declare module '@gasket/core' {
}

export interface GasketActions {
startProxyServer: () => Promise<void>;
startProxyServer: () => Promise<ProxyServer>;
}
}

Expand Down

0 comments on commit 820d46a

Please sign in to comment.