Merge branch 'configurable-local-port' into 'main'

Allow configuring the local port ditto listens on

See merge request soapbox-pub/ditto!181
This commit is contained in:
Alex Gleason 2024-04-24 17:22:58 +00:00
commit 620fd6bb74
2 changed files with 7 additions and 1 deletions

View File

@ -39,6 +39,11 @@ class Conf {
['sign', 'verify'],
);
}
static get port() {
return parseInt(Deno.env.get('PORT') || '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.port }, app.fetch);