File tree 3 files changed +7
-8
lines changed
3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
APP_PORT=3000
2
2
3
- UPSTREAM_RELAY=localhost:7777
4
- UPSTREAM_HTTPS=false
3
+ UPSTREAM_RELAY=ws://localhost:7777
5
4
6
5
UPSTREAM_RAW_URL=wss://example.com
7
6
Original file line number Diff line number Diff line change 1
1
APP_PORT = 3000
2
2
3
- UPSTREAM_RELAY = localhost:7777
4
- UPSTREAM_HTTPS = false
3
+ UPSTREAM_RELAY = ws://localhost:7777
5
4
6
5
UPSTREAM_RAW_URL = wss://example.com
7
6
Original file line number Diff line number Diff line change @@ -4,11 +4,12 @@ dotenv.loadSync({ export: true });
4
4
5
5
const APP_PORT = Number ( Deno . env . get ( 'APP_PORT' ) ) || 3000 ;
6
6
const UPSTREAM_RELAY = Deno . env . get ( 'UPSTREAM_RELAY' ) ;
7
- const UPSTREAM_HTTPS = Deno . env . get ( 'UPSTREAM_HTTPS' ) === 'true' ? true : false ;
7
+ if ( UPSTREAM_RELAY == undefined ) {
8
+ Deno . exit ( 1 ) ;
9
+ }
8
10
const UPSTREAM_RAW_URL = new URL ( Deno . env . get ( 'UPSTREAM_RAW_URL' ) || 'ws://localhost:3000' ) . href ;
9
11
10
- const UPSTREAM_URL_WS = `${ UPSTREAM_HTTPS ? 'wss://' : 'ws://' } ${ UPSTREAM_RELAY } ` ;
11
- const UPSTREAM_URL_HTTP = `${ UPSTREAM_HTTPS ? 'https://' : 'http://' } ${ UPSTREAM_RELAY } ` ;
12
+ const UPSTREAM_URL_HTTP = UPSTREAM_RELAY ?. replace ( 'wss://' , 'https://' ) . replace ( 'ws://' , 'http://' ) ;
12
13
13
14
const appendNip42Proxy = async ( { upstreamHost } : { upstreamHost : string } ) : Promise < Response > => {
14
15
const response = await fetch ( new URL ( upstreamHost ) . href , {
@@ -76,7 +77,7 @@ Deno.serve(
76
77
77
78
const stash = new Map < string , nostrTools . Event [ ] > ( ) ;
78
79
79
- const pfortner = pfortnerInit ( UPSTREAM_URL_WS , {
80
+ const pfortner = pfortnerInit ( UPSTREAM_RELAY , {
80
81
clientIp,
81
82
sendAuthOnConnect : true ,
82
83
upstreamRawAddress : UPSTREAM_RAW_URL ,
You can’t perform that action at this time.
0 commit comments