1
0
Fork 0

application and config

This commit is contained in:
Ruben Meyer 2019-09-08 19:44:15 +02:00
parent a62bb80478
commit 0484945ce8
2 changed files with 57 additions and 0 deletions

28
app.js Normal file
View File

@ -0,0 +1,28 @@
// GDS: Global Data System
global['gds'] = {
debug: (process.env.NODE_ENV === 'debug') ? true : false,
db: null,
cache: {},
cfg: require(__dirname+'/bin/config')
};
global['modules'] = {};
global['__dirname'] = __dirname;
/**
* load modules
*/
let load = (name) => {
return require(__dirname+'/bin/'+name+'/module');
};
global['modules'].logs = load('logs'); // log handler
global['logs'] = global['modules'].logs; // alias
global['modules'].web = load('web'); // web server
global['modules'].sso = load('sso'); // sso service
// custom modules
// start web server
global['modules'].web.start();

29
bin/config.js Normal file
View File

@ -0,0 +1,29 @@
module.exports = {
log: {
directory: () => {
return global['__dirname'] + "/logs/"
},
filename: () => {
return (new Date()).toISOString().substr(0, 10) + ".log"
}
},
web: {
host: "*",
port: 8080,
poweredBy: 'baseApp',
rootUrl: '/', // '/', '/SSObaseApp'
doubleSlashCheck: true, // replacing // with /
sessionKey: require('crypto').randomBytes(32).toString('hex'),
cookieKey: require('crypto').randomBytes(32).toString('hex'),
rememberMeMaxAge: 1000*60*60 // two weeks (milliseconds*seconds*minutes)
},
sso: {
authenticator: "http://localhost:8080/api/authenticate", // redirect back to this url;
redirectUser: "https://auth.rxbn.de/authenticate", // sso service
appId: "5bf5ab975f6e3f1b025105db", // app id
appSecret: "qya8ICn2h29Zp6vAsrTpRA8SZhKnoNIg" // random token
},
app: {
name: "testApp" // app name - check auth/views
}
};