Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
target: "http://localhost:8080",
logLevel: "silent",
}),
);
app.use(express.static(path.join(root, "build/vendor/public")));
if (process.env.NODE_ENV !== "development") {
app.use(express.static(path.join(root, "build/lib/public")));
}
app.use(historyFallback());
app.use(devMiddlware(compiler));
const server = killable(http.createServer(app));
["SIGINT", "SIGTERM"].forEach(sig => {
process.on(sig, () => {
console.info(`Process Ended via ${sig}`);
server.kill();
});
});
server.on("error", error => {
throw error;
});
server.on("listening", () => {
console.log("listening on", server.address().port);
});
async function startForward(commit, k8sForward, service, target) {
const server = net.createServer(function(socket) {
k8sForward.portForward(target.namespace, target.podName, [target.remotePort], socket, null, socket, 3)
k8sForward.disconnectOnErr = false
})
killable(server)
const resultPromise = new Promise((resolve) => {
const serviceString = `Service ${getServiceLabel(service)}(${service.id})`
server.on('error', (error) => {
if (server.listening) {
killServer(commit, target.localPort)
} else {
server.kill()
const prettyError = netServerPrettyError(error)
console.info(`Error while forwarding ${serviceString}: ${prettyError.message}`)
resolve({ success: false, error: prettyError })
}
})
server.listen(target.localPort, '127.0.0.1', () => {