Skip to content

Commit

Permalink
feat: add --keep-alive-timeout CLI arg to adjust server keepalive and…
Browse files Browse the repository at this point in the history
… connection timeout
  • Loading branch information
jlipps committed Dec 15, 2020
1 parent a1ef920 commit 9d8779a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,17 @@ async function main (args = null) {
await logStartupInfo(parser, args);
let appiumDriver = new AppiumDriver(args);
let routeConfiguringFunction = makeRouter(appiumDriver);
let server = await baseServer({
const serverOpts = {
routeConfiguringFunction,
port: args.port,
hostname: args.address,
allowCors: args.allowCors,
basePath: args.basePath,
});
};
if (args.keepAliveTimeout) {
serverOpts.keepAliveTimeout = args.keepAliveTimeout * 1000;
}
let server = await baseServer(serverOpts);
if (args.allowCors) {
logger.warn('You have enabled CORS requests from any host. Be careful not ' +
'to visit sites which could maliciously try to start Appium ' +
Expand Down
9 changes: 9 additions & 0 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ const args = [
'on this server'
}],

[['-ka', '--keep-alive-timeout'], {
required: false,
default: null,
dest: 'keepAliveTimeout',
type: 'int',
help: 'Number of seconds the Appium server should apply as both the keep-alive timeout ' +
'and the connection timeout for all requests. Defaults to 600 (10 minutes).'
}],

[['-ca', '--callback-address'], {
required: false,
dest: 'callbackAddress',
Expand Down

0 comments on commit 9d8779a

Please sign in to comment.