NewsBlur/node/newsblur.js
2025-02-27 23:23:29 -08:00

72 lines
1.8 KiB
JavaScript

// Generated by CoffeeScript 2.6.1
(function() {
var ENV_DEV, ENV_DOCKER, ENV_PROD, Integrations, ProfilingIntegration, Sentry, app, envresult, favicons, log, original_page, original_text, ref, server, unread_counts;
Sentry = require("@sentry/node");
Integrations = require("@sentry/integrations");
({ProfilingIntegration} = require("@sentry/profiling-node"));
app = require('express')();
server = require('http').createServer(app);
log = require('./log.js');
envresult = require('dotenv').config({
path: 'node/.env'
});
if (envresult.error) {
// throw envresult.error
envresult = require('dotenv').config();
if (envresult.error) {
log.debug(" ---> No .env file found, using defaults");
}
}
// throw envresult.error
ENV_DEV = process.env.NODE_ENV === 'development';
ENV_PROD = process.env.NODE_ENV === 'production';
ENV_DOCKER = process.env.NODE_ENV === 'docker';
original_page = require('./original_page.js').original_page;
original_text = require('./original_text.js').original_text;
favicons = require('./favicons.js').favicons;
unread_counts = require('./unread_counts.js').unread_counts;
if (!ENV_DEV && !ENV_PROD && !ENV_DOCKER) {
throw new Error("Set envvar NODE_ENV=<development,docker,production>");
}
if (false) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
debug: true,
serverName: process.env.SERVER_NAME
});
app.get("/debug", function(req, res) {
throw new Error("Debugging Sentry");
});
log.debug(`Setting up Sentry debugging: ${(ref = process.env.SENTRY_DSN) != null ? ref.substr(0, 60) : void 0}...`);
}
original_page(app);
original_text(app);
favicons(app);
unread_counts(server);
log.debug(`Starting NewsBlur Node Server: ${process.env.SERVER_NAME || 'localhost'}`);
server.listen(8008);
}).call(this);