diff --git a/src/config.ts b/src/config.ts index dfcd2f7..29f1d58 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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`; diff --git a/src/server.ts b/src/server.ts index f433cde..6333a73 100644 --- a/src/server.ts +++ b/src/server.ts @@ -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);