diff --git a/README.md b/README.md index c86d73fbe..acba764a1 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ All CLI options are optional: --corsDisallowCredentials When provided, the default Access-Control-Allow-Credentials header value will be passed as 'false'. Default: true --corsExposedHeaders Used as additional Access-Control-Exposed-Headers header value for responses. Delimit multiple values with commas. Default: 'WWW-Authenticate,Server-Authorization' --disableCookieValidation Used to disable cookie-validation on hapi.js-server +--disableScheduledEvents Disables all scheduled events. Overrides configurations in serverless.yml. --dockerHost The host name of Docker. Default: localhost --dockerHostServicePath Defines service path which is used by SLS running inside Docker container --dockerNetwork The network that the Docker container will connect to diff --git a/package.json b/package.json index 5ca4fd20d..757ec05d7 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "Gert Jansen van Rensburg (https://github.com/gertjvr)", "Guillaume Carbonneau (https://github.com/guillaume)", "György Balássy (https://github.com/balassy)", + "James Relyea (https://github.com/james-relyea)", "Jarda Snajdr (https://github.com/jsnajdr)", "Jaryd Carolin (https://github.com/horyd)", "Jeff Hall (https://github.com/electrikdevelopment)", diff --git a/src/ServerlessOffline.js b/src/ServerlessOffline.js index 2e0d8c44b..ecbf19e9e 100644 --- a/src/ServerlessOffline.js +++ b/src/ServerlessOffline.js @@ -94,7 +94,7 @@ export default class ServerlessOffline { eventModules.push(this._createHttp(httpEvents)) } - if (scheduleEvents.length > 0) { + if (!this.#options.disableScheduledEvents && scheduleEvents.length > 0) { eventModules.push(this._createSchedule(scheduleEvents)) } diff --git a/src/config/commandOptions.js b/src/config/commandOptions.js index 09f4d8d6b..70b66c154 100644 --- a/src/config/commandOptions.js +++ b/src/config/commandOptions.js @@ -28,6 +28,11 @@ export default { usage: 'Used to disable cookie-validation on hapi.js-server', type: 'boolean', }, + disableScheduledEvents: { + usage: + 'Disables all scheduled events. Overrides configurations in serverless.yml. Default: false', + type: 'boolean', + }, enforceSecureCookies: { usage: 'Enforce secure cookies', type: 'boolean', diff --git a/src/config/defaultOptions.js b/src/config/defaultOptions.js index e8a511786..7468d8cd2 100644 --- a/src/config/defaultOptions.js +++ b/src/config/defaultOptions.js @@ -8,6 +8,7 @@ export default { corsAllowOrigin: '*', corsExposedHeaders: 'WWW-Authenticate,Server-Authorization', disableCookieValidation: false, + disableScheduledEvents: false, dockerHost: 'localhost', dockerHostServicePath: null, dockerNetwork: null,