This repository has been archived by the owner on May 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
155 lines (136 loc) · 4.55 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
'use strict';
/**
* Contains configurations for the webserver
* how to connect, what directories, etc.
*
* The current working directory is the file of the config.js
* The paths are manually transformed to absoulute paths at the bottom of this script.
*
* @type {Object}
*/
const configuration = {
"security": {
"routes_ignore_login_required": [
"",
"/",
"/system/AJAX/checkLogin",
"/logout",
"/ORGRES/officerSurveyForm",
"/ORGRES/memberSurveyForm",
"/ORGRES/AJAX/idnumber",
"/ORGRES/submitMemberSurveyForm"
],
"encryption": {
"bits": 1024,
"web_workers_amount": -1
},
"enable_login_check": true
},
"debug": {
"enabled": true
},
"webserver": {
"port": 3000,
"url": "",
"controllers": {
"path": "./app/controllers"
},
"core_middlewares": {
"path": "./app/core_middlewares"
},
"core_modules": {
"path": "./app/core_modules"
},
"pre_middlewares": {
"path": "./app/pre_middlewares"
},
"routes": {
"path": "./app/routes"
},
"post_middlewares": {
"path": "./app/post_middlewares"
},
"assets": {
"path": "./app/assets"
},
"views": {
"path": "./app/views"
},
"session": {
"proxy": false,
"name": "CSO",
"resave": true,
"saveUninitialized": true,
"unset": "destroy",
"table_name": "session",
"rolling": true,
"key": "replace with an autogenerated session key later or soon, siguro sa thesis-it2 na gagagawin? Di na, sa thesis-it2.5 :(",
"cookie": {
"httpOnly": false,
"path": "/",
"sameSite": "strict",
"secure": false,
"maxAge": 3600000,
//TODO: Replace secret with auto generated one
"secret": "this is a place holder secret, would be replaced by an auto generated secret, kapag inimplement nalang siguro ako mag iisip :/"
}
},
"easter_eggs":{
"enable_footer_quotes": true,
/* Only works if "enable_footer_quotes" is true, otherwise displays a default footer */
/* Choices: "communist", "john_de_la_salle"
An invalid choice is defaulted */
"quotes_type": "communist"
},
"email": {
"host": "smtp.gmail.com",
"port": 465,
"secure": true,
"connectionTimeout": "10000",
"username": "dlsum.facultyattendance@gmail.com",
"password": "01234567891011"
},
/*
Configuration on the parsing of http requests
*/
"parsing": {
"extended": true /* Default false */,
"limit": "1mb" /* Default 100kb */,
"parameterLimit": 1000000 /* Default 1000 */
}
},
"database": {
"host": "localhost",
"port": 5432,
"database": "CSODB",
"username": "postgres",
"password": "1234",
"query_files": {
"path": "./app/queries",
"compress": true,
"minify": true
},
"models": {
"path": "./app/models"
}
}
};
/**
* Module to be use to resolve to absolute paths
* @type {function}
*/
const resolve = require('path').resolve;
/* Preprocessing of configuration data */
configuration.security.routes_ignore_login_required.sort();
/* Webserver path */
configuration.webserver.controllers.path = resolve(configuration.webserver.controllers.path);
configuration.webserver.pre_middlewares.path = resolve(configuration.webserver.pre_middlewares.path);
configuration.webserver.post_middlewares.path = resolve(configuration.webserver.post_middlewares.path);
configuration.webserver.core_modules.path = resolve(configuration.webserver.core_modules.path);
configuration.webserver.core_middlewares.path = resolve(configuration.webserver.core_middlewares.path);
configuration.webserver.assets.path = resolve(configuration.webserver.assets.path);
configuration.webserver.views.path = resolve(configuration.webserver.views.path);
/* Database paths */
configuration.database.query_files.path = resolve(configuration.database.query_files.path);
configuration.database.models.path = resolve(configuration.database.models.path);
module.exports = configuration;