diff --git a/app.js b/app.js new file mode 100644 index 0000000..bc79b10 --- /dev/null +++ b/app.js @@ -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(); diff --git a/bin/config.js b/bin/config.js new file mode 100644 index 0000000..73364e7 --- /dev/null +++ b/bin/config.js @@ -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 + } +};