import "./config/env" ; import throng from "throng" ; import * as PrivateKey from "probot/lib/private-key" ; import { createProbot } from "probot" ; import { initializeSentry } from "./config/sentry" ; import "./config/proxy" ; import { isNodeProd } from "./util/isNodeEnv" ; import configureAndLoadApp from "./configure-robot" ; const probot = createProbot ( { id : Number ( process . env . APP_ID ) , secret : process . env . WEBHOOK_SECRET , cert : PrivateKey . findPrivateKey ( ) || undefined , port : Number ( process . env . TUNNEL_PORT ) || Number ( process . env . PORT ) || 8080 , webhookPath : "/github/events" , webhookProxy : process . env . WEBHOOK_PROXY_URL , throttleOptions : { enabled : false } } ) ; async function start ( ) { initializeSentry ( ) ; probot . server . set ( "trust proxy" , true ) ; configureAndLoadApp ( probot ) ; probot . start ( ) ; } if ( isNodeProd ( ) ) { throng ( { worker : start , lifetime : Infinity } ) ; } else { start ( ) ; }