Skip to content

Commit

Permalink
feat(novu): custom tunnel support (#6711)
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1337 authored Oct 17, 2024
1 parent ec35a01 commit 5bbb8b1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions packages/cli/src/commands/dev/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ export async function devCommand(options: DevCommandOptions, anonymousId?: strin
await showWelcomeScreen();

const parsedOptions = parseOptions(options);
const devSpinner = ora('Creating a development local tunnel').start();
const NOVU_ENDPOINT_PATH = options.route;
const tunnelOrigin = await createTunnel(parsedOptions.origin, NOVU_ENDPOINT_PATH);
let tunnelOrigin: string;

const devSpinner = ora('Creating a development local tunnel').start();

if (parsedOptions.tunnel) {
tunnelOrigin = parsedOptions.tunnel;
} else {
tunnelOrigin = await createTunnel(parsedOptions.origin, NOVU_ENDPOINT_PATH);
}
devSpinner.succeed(`🛣️ Tunnel → ${tunnelOrigin}${NOVU_ENDPOINT_PATH}`);

const opts = {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/commands/dev/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type DevCommandOptions = {
studioPort: string;
dashboardUrl: string;
route: string;
tunnel: string;
};

export type LocalTunnelResponse = {
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ program
(e.g., npx novu@latest dev -p 4000)
Running the Bridge application on a different route:
(e.g., npx novu@latest dev -r /v1/api/novu)`
(e.g., npx novu@latest dev -r /v1/api/novu)
Running with a custom tunnel:
(e.g., npx novu@latest dev --tunnel https://my-tunnel.ngrok.app)`
)
.usage('[-p <port>] [-r <route>] [-o <origin>] [-d <dashboard-url>] [-sp <studio-port>]')
.option('-p, --port <port>', 'The local Bridge endpoint port', '4000')
.option('-r, --route <route>', 'The Bridge endpoint route', '/api/novu')
.option('-o, --origin <origin>', 'The Bridge endpoint origin')
.option('-d, --dashboard-url <url>', 'The Novu Cloud Dashboard URL', 'https://dashboard.novu.co')
.option('-sp, --studio-port <port>', 'The Local Studio server port', '2022')
.option('-t, --tunnel <url>', 'Self hosted tunnel. e.g. https://my-tunnel.ngrok.app')
.action(async (options: DevCommandOptions) => {
analytics.track({
identity: {
Expand Down

0 comments on commit 5bbb8b1

Please sign in to comment.