allow configuring the local port ditto listens on

This commit is contained in:
Siddharth Singh 2024-04-24 21:32:02 +05:30
parent 2bffb667c4
commit 3880f1e013
No known key found for this signature in database
2 changed files with 7 additions and 1 deletions

View File

@ -39,6 +39,11 @@ class Conf {
['sign', 'verify'],
);
}
static get localPort() {
return parseInt(Deno.env.get('DITTO_LISTEN_ON') || '8000');
}
static get relay(): `wss://${string}` | `ws://${string}` {
const { protocol, host } = Conf.url;
return `${protocol === 'https:' ? 'wss:' : 'ws:'}//${host}/relay`;

View File

@ -1,5 +1,6 @@
import '@/precheck.ts';
import '@/sentry.ts';
import app from '@/app.ts';
import { Conf } from '@/config.ts';
Deno.serve(app.fetch);
Deno.serve({ port: Conf.localPort }, app.fetch);