question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: programmatic startup/shutdown improvements

See original GitHub issue

While writing integration tests for plugin I wish I had 3 main features in the gateway:

  1. A way to shutdown a gateway instance (mainly for testing purposes, when you want to cleanup the resources).

gatewayInstance.close().then(()=>console.log("It's over"));

  1. A way to know that the gateway is ready to get requests; the run method might return a Promise

gatewayInstance.run().then(()=>console.log("Time to proxy requests"));

  1. A way to feed the gateway configuration from the code directly, and not being constrained to give file paths or directories.
const systemConfig = {};
const gatewayConfig = {}

gateway().load(systemConfig, gatewayConfig).run().then(...)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
DrMegavoltcommented, Feb 8, 2018

@jbalsip quick comment on logs https://github.com/ExpressGateway/express-gateway/blob/ca7b7aff62e36b00ea0aace5a3216edf5d8522f8/lib/plugins.js#L65

in plugin context a logger is passed. a special one for plugins. It log level is controlled by process.env.LOG_LEVEL_PLUGINS https://github.com/ExpressGateway/express-gateway/blob/master/lib/logger.js#L48

so logs will not be mixed LOG_LEVEL_PLUGINS=debug (internal policies use LOG_LEVEL_POLICY) so you should see mostly logs from your plugin and other custom plugins

or use some lib like debug to completely separate output


+1 to see the tests from your PoC

Our current helpers cover scenarios of running EG in the same process and as a separate process (looks ugly but seems to work) We use separate process to run E2E tests, but those helpers were never utilized in external plugin so it is hard to tell if it actually works correctly

Feel free to make small PRs with helpers as you see it. At some point the picture of helpers will be more or less complete so we document the approach as beta feature on the EG.io site and in the release notes. I believe feedback from others will follow, so the helpers can be improved and moved out of beta status.

beta is mostly to avoid migration issues. One can always reference specific version of EG in their plugin and do migration in there own pace.

Thanks!

1reaction
toryalsipcommented, Feb 8, 2018

That is very helpful @DrMegavolt and thank you. I’ll be sure to incorporate that into what I’m working on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Technical debt · GitHub
Feature : programmatic startup/shutdown improvements #422 opened by XVincentX enhancement. @XVincentX. From The eternal backlog. Copy card link.
Read more >
Running shutdown scripts | Compute Engine Documentation
Create and run shutdown scripts that execute commands right before a virtual machine (VM) instance is stopped or restarted. This is useful if...
Read more >
Towards accurate modeling of dynamic startup/shutdown and ...
To this end, this paper accurately accesses detailed startup and shutdown procedures of thermal units by simulating dynamic unit temperature evolution and ...
Read more >
Discusses Feb 1993 voluntary shutdown in response to indications ...
The New York Power Authority voluntarily shut down the Indian Point 3 Nuclear Power Plant in February 1993 in response to indications of...
Read more >
Server Startup and Shutdown Sequences - Communities
Welcome to the new and improved SE Communty! The UI/UX has been upgraded to provide a more intuitive and smoother user experience; This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found