File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ function parseArgs(argv: string[]): CliArgs {
3838 case '--announce' : args . announce = true ; break
3939 case '--announce-relays' : args . announceRelays = argv [ ++ i ] ; break
4040 case '--announce-key' : args . announceKey = argv [ ++ i ] ; break
41+ case '--public-url' : args . publicUrl = argv [ ++ i ] ; break
4142 case '-h' : case '--help' : printHelp ( ) ; process . exit ( 0 ) ;
4243 case '-v' : case '--version' : printVersion ( ) ; process . exit ( 0 ) ;
4344 default :
@@ -97,6 +98,7 @@ function printHelp(): void {
9798 --announce Publish service on Nostr relays for discovery
9899 --announce-relays <urls> Comma-separated relay URLs (wss://...)
99100 --announce-key <hex> Nostr secret key for signing (auto-generated if omitted)
101+ --public-url <url> Public URL for announcements (overrides tunnel URL)
100102
101103 Storage:
102104 --storage <type> memory | sqlite (default: memory)
@@ -280,7 +282,7 @@ export async function main(argv: string[] = process.argv): Promise<void> {
280282 if ( config . announceRelays . length === 0 ) {
281283 logger . warn ( '--announce enabled but no --announce-relays provided' )
282284 } else {
283- const publicUrl = tunnelResult ?. url ?? `http://localhost:${ config . port } `
285+ const publicUrl = config . publicUrl ?? tunnelResult ?. url ?? `http://localhost:${ config . port } `
284286
285287 const { announceService } = await import ( '402-announce' )
286288 const { randomBytes } = await import ( 'node:crypto' )
Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ export interface TokenTollConfig {
6161 announceRelays : string [ ]
6262 /** Hex Nostr secret key for signing announcements. */
6363 announceKey : string
64+ /** Explicit public URL for announcements (overrides tunnel URL). */
65+ publicUrl ?: string
6466}
6567
6668export interface CliArgs {
@@ -89,6 +91,7 @@ export interface CliArgs {
8991 announce ?: boolean
9092 announceRelays ?: string
9193 announceKey ?: string
94+ publicUrl ?: string
9295}
9396
9497export interface FileConfig {
@@ -406,6 +409,7 @@ export function loadConfig(
406409 const announce = args . announce ?? ( env . ANNOUNCE === 'true' || false )
407410 const announceRelays = ( args . announceRelays ?? env . ANNOUNCE_RELAYS ?? '' ) . split ( ',' ) . filter ( Boolean )
408411 const announceKey = args . announceKey ?? env . ANNOUNCE_KEY ?? ''
412+ const publicUrl = args . publicUrl ?? env . PUBLIC_URL ?? undefined
409413
410414 return {
411415 upstream : upstream . replace ( / \/ + $ / , '' ) ,
@@ -437,5 +441,6 @@ export function loadConfig(
437441 announce,
438442 announceRelays,
439443 announceKey,
444+ publicUrl,
440445 }
441446}
You can’t perform that action at this time.
0 commit comments