1 | /*
|
2 |
|
3 | ----------------------------------------------------------------------------
|
4 | | rippleosi-ewd3: EWD3/ewd-xpress Middle Tier for Ripple OSI |
|
5 | | |
|
6 | | Copyright (c) 2016 Ripple Foundation Community Interest Company |
|
7 | | All rights reserved. |
|
8 | | |
|
9 | | http://rippleosi.org |
|
10 | | Email: code.custodian@rippleosi.org |
|
11 | | |
|
12 | | Author: Rob Tweed, M/Gateway Developments Ltd |
|
13 | | |
|
14 | | Licensed under the Apache License, Version 2.0 (the "License"); |
|
15 | | you may not use this file except in compliance with the License. |
|
16 | | You may obtain a copy of the License at |
|
17 | | |
|
18 | | http://www.apache.org/licenses/LICENSE-2.0 |
|
19 | | |
|
20 | | Unless required by applicable law or agreed to in writing, software |
|
21 | | distributed under the License is distributed on an "AS IS" BASIS, |
|
22 | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
23 | | See the License for the specific language governing permissions and |
|
24 | | limitations under the License. |
|
25 | ----------------------------------------------------------------------------
|
26 |
|
27 | 17 October 2016
|
28 |
|
29 | */
|
30 |
|
31 | var ewdXpress = require('ewd-xpress').master;
|
32 |
|
33 | var config = {
|
34 | managementPassword: 'keepThisSecret!',
|
35 | serverName: 'RippleOSI EWD3 Server',
|
36 | port: 3000,
|
37 | poolSize: 4,
|
38 | webServerRootPath: '/opt/tomcat/ripple',
|
39 | database: {
|
40 | type: 'gtm'
|
41 | },
|
42 | lockSession: false,
|
43 | /*
|
44 | resilientMode: {
|
45 | keepPeriod: 600 // just keep the last 10 minutes
|
46 | }
|
47 | */
|
48 | };
|
49 |
|
50 | var routes = [
|
51 | {
|
52 | path: '/api',
|
53 | module: 'ewd-ripple'
|
54 | }
|
55 | ];
|
56 |
|
57 | var q = ewdXpress.start(config, routes);
|
58 |
|
59 | var app = ewdXpress.intercept().app;
|
60 |
|
61 | var pasConfig = {
|
62 | openEHR: {
|
63 | pasModule: 'mysqlPAS',
|
64 | summaryHeadings: ['allergies', 'problems', 'medications', 'contacts', {name: 'transfers', value: true}]
|
65 | }
|
66 | };
|
67 |
|
68 | var pas = process.argv[2] || 'openEHR'
|
69 | q.userDefined['rippleUser'] = pasConfig[pas];
|
70 |
|
71 | function errorHandler (err, req, res, next) {
|
72 | if (res.headersSent) {
|
73 | return next(err)
|
74 | }
|
75 | res.status(500)
|
76 | res.render('error', { error: err })
|
77 | }
|
78 |
|
79 | app.use(errorHandler);
|
80 |
|
81 |
|
82 |
|