Skip to content

Commit

Permalink
fix: fail in init if publicURL is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
catdevnull committed Mar 8, 2024
1 parent af424e9 commit 816455b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ await yargs(hideBin(process.argv)).command('run', 'start the Social Inbox servic
const storage = argv.storage ?? paths.data
const publicURL = argv.publicURL ?? `http://${host}:${port}`

if (!(publicURL.startsWith('http://') || publicURL.startsWith('https://'))) {
throw new Error('Missing protocol in publicURL')
}
if (publicURL.endsWith('/')) {
throw new Error('Trailing slash in publicURL')
}

const server = await buildServer({
port,
host,
Expand Down

0 comments on commit 816455b

Please sign in to comment.