31 lines
971 B
JavaScript
31 lines
971 B
JavaScript
|
|
const path = require("path");
|
||
|
|
const grpc = require("@grpc/grpc-js");
|
||
|
|
const protoLoader = require("@grpc/proto-loader");
|
||
|
|
const promisify = require(path.join(__dirname, "util/grpc-promisify"));
|
||
|
|
global.__pgQuery = require(path.join(__dirname, "util/pg")).pgQuery;
|
||
|
|
|
||
|
|
process.on("uncaughtException", (reason, p) => {
|
||
|
|
console.log("error:", reason, p);
|
||
|
|
// Sentry.captureException({ reason, p });
|
||
|
|
// logger.error({ reason, p }, 'uncaughtException error')
|
||
|
|
});
|
||
|
|
|
||
|
|
process.on("unhandledRejection", (reason, p) => {
|
||
|
|
console.log("error:", reason, p);
|
||
|
|
// Sentry.captureException({ reason, p });
|
||
|
|
// logger.error({ reason, p }, 'unhandledRejection error')
|
||
|
|
});
|
||
|
|
|
||
|
|
const Image_PATH = path.join(__dirname, "protos/image.proto");
|
||
|
|
|
||
|
|
const imageDefinition = protoLoader.loadSync(Image_PATH, {
|
||
|
|
defaults: true,
|
||
|
|
});
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
imageProto: grpc.loadPackageDefinition(imageDefinition).image,
|
||
|
|
imageImpl: require(path.join(__dirname, "/app/controller")),
|
||
|
|
grpc,
|
||
|
|
promisify,
|
||
|
|
};
|