Skip to content

Commit

Permalink
feat(cli): add server timeout configuration #623 (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
kronken authored and benjie committed Jul 20, 2018
1 parent 0a29911 commit 5f48a08
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/postgraphile/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <string>', '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 <number>', 'set the timeout value in milliseconds for sockets', parseFloat)
.option('--cluster-workers <count>', '[experimental] spawn <count> 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)')
Expand Down Expand Up @@ -197,6 +198,7 @@ const {
schema: dbSchema,
host: hostname = 'localhost',
port = 5000,
timeout: serverTimeout,
maxPoolSize,
defaultRole: pgDefaultRole,
graphql: graphqlRoute = '/graphql',
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5f48a08

Please sign in to comment.