File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
packages/world-postgres/src/proxies Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -7,25 +7,26 @@ export function createHttpProxy(opts: {
77 baseUrl ?: string ;
88 securityToken : string ;
99} ) : WkfProxy {
10- const resolveBaseUrl = ( ) : string => {
10+ // Resolve baseUrl lazily at request time to support dynamic port detection
11+ const getBaseUrl = ( ) : string => {
1112 if ( opts . baseUrl ) return opts . baseUrl ;
1213 if ( opts . port ) return `http://localhost:${ opts . port } ` ;
14+ // Check for PORT env var (set by server after binding)
15+ if ( process . env . PORT ) return `http://localhost:${ process . env . PORT } ` ;
1316 return 'http://localhost:3000' ;
1417 } ;
1518
16- const baseUrl = resolveBaseUrl ( ) ;
17-
1819 return {
1920 proxyWorkflow : async ( message : MessageData ) : Promise < Response > => {
2021 return fetch (
21- `${ baseUrl } /.well-known/workflow/v1/flow` ,
22+ `${ getBaseUrl ( ) } /.well-known/workflow/v1/flow` ,
2223 prepareRequestParams ( message , opts . securityToken )
2324 ) ;
2425 } ,
2526
2627 proxyStep : async ( message : MessageData ) : Promise < Response > => {
2728 return fetch (
28- `${ baseUrl } /.well-known/workflow/v1/step` ,
29+ `${ getBaseUrl ( ) } /.well-known/workflow/v1/step` ,
2930 prepareRequestParams ( message , opts . securityToken )
3031 ) ;
3132 } ,
You can’t perform that action at this time.
0 commit comments