Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(novu): custom tunnel support #6711

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading