diff --git a/src/postgraphile/cli.ts b/src/postgraphile/cli.ts index 44f194270e..01be43ef46 100755 --- a/src/postgraphile/cli.ts +++ b/src/postgraphile/cli.ts @@ -128,6 +128,7 @@ program .option('-b, --disable-graphiql', 'disables the GraphiQL interface. overrides the GraphiQL route option') .option('-o, --cors', 'enable generous CORS settings; disabled by default, if possible use a proxy instead') .option('-l, --body-size-limit ', 'set the maximum size of JSON bodies that can be parsed (default 100kB) The size can be given as a human-readable string, such as \'200kB\' or \'5MB\' (case insensitive).') + .option('--timeout ', 'set the timeout value in milliseconds for sockets', parseFloat) .option('--cluster-workers ', '[experimental] spawn workers to increase throughput', parseFloat) .option('--enable-query-batching', '[experimental] enable the server to process multiple GraphQL queries in one request') .option('--disable-query-log', 'disable logging queries to console (recommended in production)') @@ -197,6 +198,7 @@ const { schema: dbSchema, host: hostname = 'localhost', port = 5000, + timeout: serverTimeout, maxPoolSize, defaultRole: pgDefaultRole, graphql: graphqlRoute = '/graphql', @@ -448,6 +450,10 @@ if (noServer) { const rawMiddleware = postgraphile(pgConfig, schemas, postgraphileOptions) const middleware = pluginHook('cli:server:middleware', rawMiddleware, { options: postgraphileOptions }) const server = createServer(middleware) + if (serverTimeout) { + server.timeout = serverTimeout + } + pluginHook('cli:server:created', server, { options: postgraphileOptions, middleware }) // Start our server by listening to a specific port and host name. Also log