diff --git a/src/config.ts b/src/config.ts index dfcd2f7..c4d6a9b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -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`; diff --git a/src/server.ts b/src/server.ts index f433cde..68af681 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.port }, app.fetch);