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.

Maybe add a "on init" method for checking environment and other stuff

See original GitHub issue

Feature Request

Is your feature request related to a problem? Please describe. For GitHub Enterprise usage, sometimes we want to check the environment before starting up the server. It’s good to know the problems right away.

Describe the solution you’d like Add an “on init” method that will run every time (or configurable) that users can define in the Application to do some health checking.

Describe alternatives you’ve considered Adding a script that npm run dev runs would also work, but doesn’t feel as clean.

Teachability, Documentation, Adoption, Migration Strategy Can probably simply document this the same way as any other Application API.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gr2mcommented, Sep 13, 2020

In my case, that will be if I see GHE_HOST is set but no ACTOR_NAME found, I can immediately error out with a message telling the user running the GitHub Enterprise variant without setting the actor name is probably not going to work.

Why not do that in your app’s code?

module.exports = app => {
  if (process.env.GHE_HOST && !process.env.ACTOR_NAME) {
    throw new Error('`ACTOR_NAME` environment variable is not set')
  }
  // ...
}


0reactions
tianhaoz95commented, Sep 16, 2020

I think you are right about why that wasn’t executed. Yes doing it in the top level app initiation works. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google cloud function Golang unit test with init() - Stack Overflow
Specifically, the environment variables that I want to inject during the test phase are not recognized, since the init() function always ...
Read more >
Environment Dependencies — Ray 2.2.0
There are two options for when to install the runtime environment: As soon as the job starts (i.e., as soon as ray.init() is...
Read more >
Unit Tests, How to Write Testable Code, and Why It Matters
Essentially, a unit test is a method that instantiates a small portion of our application and verifies its behavior independently from other parts....
Read more >
Environments - AWS Cloud Development Kit (AWS CDK) v2
Access environment variables via Node's process object. Use the os module's environ dictionary to access environment variables. Use System.
Read more >
How To Set Environment Variables - Twilio
Environment variables in your system describe your environment. Learn how to set up environment variables in Linux, Windows, macOS, ...
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