A web application allowing people to create an account, configure a profile, and share a list of URLs on that profile.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

68 lines
1.7 KiB

// dtp-sites.js
// Copryright (C) Digital Telepresence, LLC
// Licence: Apache-2.0
'use strict';
require('dotenv').config();
const path = require('path');
const { SitePlatform, SiteLog } = require(path.join(__dirname, 'lib', 'site-lib'));
module.pkg = require(path.join(__dirname, 'package.json'));
module.config = {
componentName: 'links-web',
root: __dirname,
site: {
name: process.env.DTP_SITE_NAME,
description: process.env.DTP_SITE_DESCRIPTION,
domain: process.env.DTP_SITE_DOMAIN,
domainKey: process.env.DTP_SITE_DOMAIN_KEY,
company: process.env.DTP_SITE_COMPANY || 'Digital Telepresence, LLC',
},
http: {
address: process.env.HTTP_BIND_ADDRESS,
port: parseInt(process.env.HTTP_BIND_PORT, 10),
},
};
module.log = new SiteLog(module, module.config.componentName);
(async ( ) => {
process.on('unhandledRejection', (error, p) => {
module.log.error('Unhandled rejection', {
error: error,
promise: p,
stack: error.stack
});
});
process.on('warning', (error) => {
module.log.alert('warning', { error });
});
process.once('SIGINT', async ( ) => {
module.log.info('SIGINT received');
module.log.info('requesting shutdown...');
const exitCode = await SitePlatform.shutdown();
process.nextTick(( ) => {
process.exit(exitCode);
});
});
process.once('SIGUSR2', async ( ) => {
await SitePlatform.shutdown();
process.kill(process.pid, 'SIGUSR2');
});
try {
await SitePlatform.startPlatform(module);
await SitePlatform.startWebServer(module);
} catch (error) {
module.log.error('failed to start DTP Sites web server', { error });
process.exit(-1);
}
})();