diff --git a/bin/ncm-ci.js b/bin/ncm-ci.js index aa0ddf0..c45352e 100755 --- a/bin/ncm-ci.js +++ b/bin/ncm-ci.js @@ -7,6 +7,12 @@ const graphql = require('../lib/graphql') const chalk = require('chalk') const fetch = require('node-fetch') +// Setting up a timeout to be used with fetch() – will use the NCM_TIMEOUT environment +// variable or default to 2 minutes (120 seconds / 120000 milliseconds) +const timeout = process.env.NCM_TIMEOUT + ? Number(process.env.NCM_TIMEOUT) * 1000 + : 120000 + if (!process.env.NCM_TOKEN) { console.error(` Usage @@ -49,7 +55,8 @@ const getUserDetails = async () => { const res = await fetch(`${api.accounts}/user/details`, { headers: { Authorization: `Bearer ${token}` - } + }, + timeout }) const details = await res.json() if (