Skip to content

Commit

Permalink
server: remove port requirement, permit running on paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrxtchy committed Nov 4, 2023
1 parent 1192e14 commit 2a711af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const {argv: argvObj} = yargs(process.argv.slice(2))
alias: 'p',
default: 3000,
describe: 'The port that Flood should listen for web connections on',
type: 'number',
type: 'string',
})
.option('secret', {
alias: 's',
Expand Down
5 changes: 4 additions & 1 deletion server/bin/web-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ const startWebServer = () => {

server.on('error', handleError);
server.on('listening', handleListening);
process.on('exit', () => {
server.close();
});

const address = chalk.underline(`${useSSL ? 'https' : 'http'}://${host}:${port}`);
const address = chalk.underline(typeof port === 'string' ? port : `${useSSL ? 'https' : 'http'}://${host}:${port}`);

console.log(chalk.green(`Flood server ${packageJSON.version} starting on ${address}\n`));

Expand Down
6 changes: 3 additions & 3 deletions shared/schema/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ export const configSchema = strictObject({
// CLI argument: --host / -h
// The host that Flood should listen for web connections on.
// To listen on all interfaces, change to `floodServerHost: '0.0.0.0'`. [default: '127.0.0.1']
floodServerHost: string(),
floodServerHost: string().optional(),

// CLI argument: --port / -p
// The port that Flood should listen for web connections on. [default: 3000]
floodServerPort: number().int().positive(),
// The port or path that Flood should listen for web connections on. [default: 3000]
floodServerPort: number().int().positive().or(string()),

// CLI argument: --maxhistorystates
// Flood keeps a history of torrent download and upload speeds.
Expand Down

0 comments on commit 2a711af

Please sign in to comment.