miolo 3.0.0-beta.2 → 3.0.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,463 +9,469 @@ const SESSION_MAX_AGE = 86400 * 10 * 1000
9
9
  // Then you can configure miolo using process.env.WHATEVER.
10
10
 
11
11
 
12
- export default {
13
- name: process.env.MIOLO_NAME,
14
- http: {
15
- port: process.env?.MIOLO_PORT || 8001,
16
- hostname: process.env?.MIOLO_HOSTNAME || 'localhost',
12
+ export default function make_config_defaults() {
13
+
14
+ return {
15
+ name: process.env.MIOLO_NAME || 'miolo',
16
+ http: {
17
+ port: process.env?.MIOLO_PORT || 8001,
18
+ hostname: process.env?.IS_DOCKER === "true"
19
+ ? '0.0.0.0'
20
+ : process.env?.MIOLO_HOSTNAME || 'localhost',
17
21
 
18
- catcher_url: '/sys/jserror',
19
-
20
- static: {
21
- favicon: '',
22
- folders: {}
23
- },
24
-
25
- // cors can be:
26
- // - false
27
- // - simple (just assign Access-Control-Allow-Origin='*' and Access-Control-Expose-Headers='SourceMap,X-SourceMap'
28
- // - true enable @koa/cors
29
- // - {options} enable @koa/cors and use the custom options
30
- //
31
- cors: process.env.MIOLO_HTTP_CORS==='true'
32
- ? true
33
- : process.env.MIOLO_HTTP_CORS==='simple'
34
- ? 'simple'
35
- : false,
22
+ catcher_url: '/sys/jserror',
23
+
24
+ static: {
25
+ favicon: '',
26
+ folders: {}
27
+ },
28
+
29
+ // cors can be:
30
+ // - false
31
+ // - simple (just assign Access-Control-Allow-Origin='*' and Access-Control-Expose-Headers='SourceMap,X-SourceMap'
32
+ // - true enable @koa/cors
33
+ // - {options} enable @koa/cors and use the custom options
34
+ //
35
+ cors: process.env.MIOLO_HTTP_CORS==='true'
36
+ ? true
37
+ : process.env.MIOLO_HTTP_CORS==='simple'
38
+ ? 'simple'
39
+ : false,
36
40
 
37
- // proxy can be:
38
- // - false
39
- // - true enable koa-proxies and use default options
40
- // - {options} enable koa-proxies and use the custom options
41
- proxy: process.env.MIOLO_HTTP_PROXY==='true',
41
+ // proxy can be:
42
+ // - false
43
+ // - true enable koa-proxies and use default options
44
+ // - {options} enable koa-proxies and use the custom options
45
+ proxy: process.env.MIOLO_HTTP_PROXY==='true',
42
46
 
43
- ratelimit: {
44
- /* eslint-disable no-unused-vars */
45
- max: parseInt(process.env.MIOLO_RATELIMIT_MAX || 1000),
46
- duration: parseInt(process.env.MIOLO_RATELIMIT_DURATION || 60 * 1000), // miliseconds
47
- errorMessage: 'Rate Limit reached',
48
- //whitelist: (ctx) => false,
49
- //blacklist: (ctx) => false,
50
- whitelist_ips: process.env.MIOLO_RATELIMIT_WHITELIST_IPS?.split(',') || [],
51
- blacklist_ips: process.env.MIOLO_RATELIMIT_BLACKLIST_IPS?.split(',') || [],
52
- ipsum_folder: '/var/ipsum' // https://github.com/stamparm/ipsum
53
- },
47
+ ratelimit: {
48
+ /* eslint-disable no-unused-vars */
49
+ max: parseInt(process.env.MIOLO_RATELIMIT_MAX || 1000),
50
+ duration: parseInt(process.env.MIOLO_RATELIMIT_DURATION || 60 * 1000), // miliseconds
51
+ errorMessage: 'Rate Limit reached',
52
+ //whitelist: (ctx) => false,
53
+ //blacklist: (ctx) => false,
54
+ whitelist_ips: process.env.MIOLO_RATELIMIT_WHITELIST_IPS?.split(',') || [],
55
+ blacklist_ips: process.env.MIOLO_RATELIMIT_BLACKLIST_IPS?.split(',') || [],
56
+ ipsum_folder: '/var/ipsum' // https://github.com/stamparm/ipsum
57
+ },
54
58
 
55
- request: {
56
- lazy: parseInt(process.env.MIOLO_REQUEST_LAZY || 1), // seconds to consider lazy a request
57
- slow: parseInt(process.env.MIOLO_REQUEST_SLOW || 2), // seconds to consider slow a request
58
- onStart: undefined,
59
- // (ctx, times) => { return begin_result}
60
- onDone: undefined,
61
- // (ctx, begin_result, times) => {},
62
- geoip: {
63
- enabled: process.env.MIOLO_GEOIP_ENABLED==='true',
64
- db: process.env.MIOLO_GEOIP_DB,
65
- local_ips: process.env.MIOLO_GEOIP_LOCAL_IPS?.split(',') || [
66
- '127.0.0.1'
67
- ]
59
+ request: {
60
+ lazy: parseInt(process.env.MIOLO_REQUEST_LAZY || 1), // seconds to consider lazy a request
61
+ slow: parseInt(process.env.MIOLO_REQUEST_SLOW || 2), // seconds to consider slow a request
62
+ onStart: undefined,
63
+ // (ctx, times) => { return begin_result}
64
+ onDone: undefined,
65
+ // (ctx, begin_result, times) => {},
66
+ geoip: {
67
+ enabled: process.env.MIOLO_GEOIP_ENABLED==='true',
68
+ db: process.env.MIOLO_GEOIP_DB,
69
+ local_ips: process.env.MIOLO_GEOIP_LOCAL_IPS?.split(',') || [
70
+ '127.0.0.1'
71
+ ]
72
+ }
68
73
  }
69
- }
70
-
71
- },
72
- session: {
73
- salt: process.env.MIOLO_SESSION_SALT || 'SUPER_SALTY_YES?',
74
- secret: process.env.MIOLO_SESSION_SECRET || 'SUPER_SECRET_KEY_KERE',
75
- options: {
76
- /** (number || 'session') maxAge in ms (default is 1 days) */
77
- /** 'session' will result in a cookie that expires when session/browser is closed */
78
- /** Warning: If a session cookie is stolen, this cookie will never expire */
79
- maxAge: parseInt(process.env.MIOLO_SESSION_MAX_AGE || SESSION_MAX_AGE),
80
-
81
- /** (boolean) automatically commit headers (default true) */
82
- //autoCommit: true,
83
-
84
- /** (boolean) can overwrite or not (default true) */
85
- //overwrite: true,
86
-
87
- /** (boolean) httpOnly or not (default true) */
88
- //httpOnly: true,
89
-
90
- /** (boolean) signed or not (default true) */
91
- //signed: true,
92
-
93
- /** (boolean) Force a session identifier cookie to be set on every response. The expiration is reset to the original maxAge, resetting the expiration countdown. (default is false) */
94
- //rolling: false,
95
74
 
96
- /** (boolean) renew session when session is nearly expired, so we can always keep user logged in. (default is false)*/
97
- //renew: false,
75
+ },
76
+ session: {
77
+ salt: process.env.MIOLO_SESSION_SALT || 'SUPER_SALTY_YES?',
78
+ secret: process.env.MIOLO_SESSION_SECRET || 'SUPER_SECRET_KEY_KERE',
79
+ options: {
80
+ /** (number || 'session') maxAge in ms (default is 1 days) */
81
+ /** 'session' will result in a cookie that expires when session/browser is closed */
82
+ /** Warning: If a session cookie is stolen, this cookie will never expire */
83
+ maxAge: parseInt(process.env.MIOLO_SESSION_MAX_AGE || SESSION_MAX_AGE),
84
+
85
+ /** (boolean) automatically commit headers (default true) */
86
+ //autoCommit: true,
87
+
88
+ /** (boolean) can overwrite or not (default true) */
89
+ //overwrite: true,
90
+
91
+ /** (boolean) httpOnly or not (default true) */
92
+ //httpOnly: true,
93
+
94
+ /** (boolean) signed or not (default true) */
95
+ //signed: true,
96
+
97
+ /** (boolean) Force a session identifier cookie to be set on every response. The expiration is reset to the original maxAge, resetting the expiration countdown. (default is false) */
98
+ //rolling: false,
99
+
100
+ /** (boolean) renew session when session is nearly expired, so we can always keep user logged in. (default is false)*/
101
+ //renew: false,
98
102
 
99
- /** (boolean) secure cookie*/
100
- /** You may want to set it as true in your Production environement,
101
- * while false at DEV time.
102
- */
103
- secure: process.env?.MIOLO_SESSION_SECURE === 'true',
104
-
105
- /** (string) session cookie sameSite options (default null, don't set it) */
106
- sameSite: 'lax', // 'strict',
107
- }
108
- },
109
- db: {
110
- config: {
111
- dialect: process.env.MIOLO_DB_DIALECT,
112
- host: process.env.MIOLO_DB_HOST,
113
- port: process.env.MIOLO_DB_PORT,
114
- database: process.env.MIOLO_DB_DATABASE,
115
- user: process.env.MIOLO_DB_USER,
116
- password: process.env.MIOLO_DB_PASSWORD,
117
- // Maximum number of connection in pool
118
- max: parseInt(process.env.MIOLO_DB_POOL_MAX),
119
- // Minimum number of connection in pool
120
- min: parseInt(process.env.MIOLO_DB_POOL_MIN),
121
- // The maximum time, in milliseconds, that a connection can be idle before being released.
122
- // Use with combination of evict for proper working,
123
- // for more details read https://github.com/coopernurse/node-pool/issues/178#issuecomment-327110870,
124
- idleTimeoutMillis: parseInt(process.env.MIOLO_DB_POOL_IDLE_TIMEOUT_MS),
103
+ /** (boolean) secure cookie*/
104
+ /** You may want to set it as true in your Production environement,
105
+ * while false at DEV time.
106
+ */
107
+ secure: process.env?.MIOLO_SESSION_SECURE === 'true',
108
+
109
+ /** (string) session cookie sameSite options (default null, don't set it) */
110
+ sameSite: 'lax', // 'strict',
111
+ }
125
112
  },
126
- options: {
127
- tables: []
113
+ db: {
114
+ config: {
115
+ dialect: process.env.MIOLO_DB_DIALECT || 'postgres',
116
+ host: process.env.MIOLO_DB_HOST || 'localhost',
117
+ port: process.env.MIOLO_DB_PORT || 5432,
118
+ database: process.env.MIOLO_DB_DATABASE || 'miolo',
119
+ user: process.env.MIOLO_DB_USER || 'postgres',
120
+ password: process.env.MIOLO_DB_PASSWORD || 'postgres',
121
+ // Maximum number of connection in pool
122
+ max: parseInt(process.env.MIOLO_DB_POOL_MAX || 5),
123
+ // Minimum number of connection in pool
124
+ min: parseInt(process.env.MIOLO_DB_POOL_MIN || 0),
125
+ // The maximum time, in milliseconds, that a connection can be idle before being released.
126
+ // Use with combination of evict for proper working,
127
+ // for more details read https://github.com/coopernurse/node-pool/issues/178#issuecomment-327110870,
128
+ idleTimeoutMillis: parseInt(process.env.MIOLO_DB_POOL_IDLE_TIMEOUT_MS || 10000),
129
+ },
130
+ options: {
131
+ tables: []
128
132
 
129
- // cache:
130
- // Refer to top level cache option
131
- // cache: {...}
132
-
133
- // log:
134
- // We will pass, on the fly, miolo logger to calustra
135
- // But specifying a level here, we can customize the level only for db/calustra actions
136
- // log: 'silly',
137
- }
138
- },
139
- routes: {
140
- bodyField: undefined,
141
-
142
- // auth: {
143
- // require: false, // true / false / 'read-only'
144
- // action: 'redirect', // 'error'
145
- // redirect_url: '/',
146
- // error_code: 401
147
- // },
148
- // before: async (ctx) => {return bool} // If bool false, query callback not run
149
- // after : async (ctx, result) => {return modified_result}
133
+ // cache:
134
+ // Refer to top level cache option
135
+ // cache: {...}
136
+
137
+ // log:
138
+ // We will pass, on the fly, miolo logger to calustra
139
+ // But specifying a level here, we can customize the level only for db/calustra actions
140
+ // log: 'silly',
141
+ }
142
+ },
143
+ routes: {
144
+ bodyField: undefined,
150
145
 
151
- crud: [{
152
- prefix: '',
153
- routes: [/*
154
- name: '',
155
- url: '/../..', // default to 'name'
156
- mode: 'r/w/rw',
157
- bodyField: '',
146
+ // auth: {
147
+ // require: false, // true / false / 'read-only'
148
+ // action: 'redirect', // 'error'
149
+ // redirect_url: '/',
150
+ // error_code: 401
151
+ // },
152
+ // before: async (ctx) => {return bool} // If bool false, query callback not run
153
+ // after : async (ctx, result) => {return modified_result}
154
+
155
+ crud: [{
156
+ prefix: '',
157
+ routes: [/*
158
+ name: '',
159
+ url: '/../..', // default to 'name'
160
+ mode: 'r/w/rw',
161
+ bodyField: '',
158
162
 
159
- useUserFields: {
160
- use: false,
161
- fieldNames: {
162
- created_by: 'created_by',
163
- last_update_by: 'last_update_by'
163
+ useUserFields: {
164
+ use: false,
165
+ fieldNames: {
166
+ created_by: 'created_by',
167
+ last_update_by: 'last_update_by'
168
+ }
164
169
  }
165
- }
166
- auth: ...,
167
- before: ...,
168
- after : ...
169
- */],
170
- }],
171
- queries: [/*
172
- {
173
- prefix: '',
174
- auth: ...,
175
- before: ...,
176
- after : ...
170
+ auth: ...,
171
+ before: ...,
172
+ after : ...
173
+ */],
174
+ }],
175
+ queries: [/*
176
+ {
177
+ prefix: '',
178
+ auth: ...,
179
+ before: ...,
180
+ after : ...
177
181
 
178
- routes: [
179
- {
180
- url: '/../..',
181
- method: 'GET/POST',
182
- callback: async (ctx) => { ctx.body = result } ,
183
- // or
184
- callback_fn: async (miolo, params) => { return result } ,
185
- auth: ...,
186
- before: ...,
187
- after : ...
188
- },
189
- ],
190
- },
191
- */],
192
- },
193
- log: {
194
- level: process.env.MIOLO_LOG_LEVEL || 'debug',
195
- format: {
196
- locale: 'en-GB'
197
- },
198
- console: {
199
- enabled: process.env.MIOLO_LOG_CONSOLE_ENABLED === 'true',
200
- level: process.env.MIOLO_LOG_CONSOLE_LEVEL || process.env.MIOLO_LOG_LEVEL || 'debug',
182
+ routes: [
183
+ {
184
+ url: '/../..',
185
+ method: 'GET/POST',
186
+ callback: async (ctx) => { ctx.body = result } ,
187
+ // or
188
+ callback_fn: async (miolo, params) => { return result } ,
189
+ auth: ...,
190
+ before: ...,
191
+ after : ...
192
+ },
193
+ ],
194
+ },
195
+ */],
201
196
  },
202
- file: {
203
- enabled: process.env.MIOLO_LOG_FILE_ENABLED === 'true',
204
- level: process.env.MIOLO_LOG_FILE_LEVEL || process.env.MIOLO_LOG_LEVEL || 'debug',
205
- filename: process.env.MIOLO_LOG_FILE_PATH || '/var/log/afialapis/%MIOLO%.log',
206
-
207
- //frequency: undefined,
208
- //datePattern: 'YYYY-MM-DD',
209
- zippedArchive: true,
197
+ log: {
198
+ level: process.env.MIOLO_LOG_LEVEL || 'debug',
199
+ format: {
200
+ locale: 'en-GB'
201
+ },
202
+ console: {
203
+ enabled: process.env.MIOLO_LOG_CONSOLE_ENABLED === 'true',
204
+ level: process.env.MIOLO_LOG_CONSOLE_LEVEL || process.env.MIOLO_LOG_LEVEL || 'debug',
205
+ },
206
+ file: {
207
+ enabled: process.env.MIOLO_LOG_FILE_ENABLED === 'true',
208
+ level: process.env.MIOLO_LOG_FILE_LEVEL || process.env.MIOLO_LOG_LEVEL || 'debug',
209
+ filename: process.env.MIOLO_LOG_FILE_PATH || '/var/log/afialapis/%MIOLO%.log',
210
+
211
+ //frequency: undefined,
212
+ //datePattern: 'YYYY-MM-DD',
213
+ zippedArchive: true,
210
214
 
211
- maxsize: 1024 * 1024 * 20,
212
- maxFiles: 20,
215
+ maxsize: 1024 * 1024 * 20,
216
+ maxFiles: 20,
213
217
 
214
- //maxSize: '20m',
215
- ///maxFiles: '10d',
218
+ //maxSize: '20m',
219
+ ///maxFiles: '10d',
216
220
 
217
- //filename: '/var/log/afialapis/%MIOLO%.%DATE%.log',
218
- //auditFile: '/var/log/afialapis/%MIOLO%.audit.json',
219
- //createSymlink: true,
220
- //symlinkName: '%MIOLO%.log'
221
+ //filename: '/var/log/afialapis/%MIOLO%.%DATE%.log',
222
+ //auditFile: '/var/log/afialapis/%MIOLO%.audit.json',
223
+ //createSymlink: true,
224
+ //symlinkName: '%MIOLO%.log'
221
225
 
222
- hup_patch: false
226
+ hup_patch: false
227
+ },
228
+ mail: {
229
+ enabled: process.env.MIOLO_LOG_MAIL_ENABLED
230
+ ? process.env.MIOLO_LOG_MAIL_ENABLED === 'true'
231
+ : false,
232
+ level: process.env.MIOLO_LOG_MAIL_LEVEL || process.env.MIOLO_LOG_LEVEL || 'warn',
233
+ name: process.env.MIOLO_NAME || 'miolo',
234
+ from: process.env.MIOLO_LOG_MAIL_FROM || 'noreply@mail.com',
235
+ to: process.env.MIOLO_LOG_MAIL_TO || 'noreply@mail.com'
236
+ }
223
237
  },
224
238
  mail: {
225
- enabled: process.env.MIOLO_LOG_MAIL_ENABLED
226
- ? process.env.MIOLO_LOG_MAIL_ENABLED === 'true'
227
- : false,
228
- level: process.env.MIOLO_LOG_MAIL_LEVEL || process.env.MIOLO_LOG_LEVEL || 'warn',
229
- name: process.env.MIOLO_NAME || 'miolo',
230
- from: process.env.MIOLO_LOG_MAIL_FROM || 'noreply@mail.com',
231
- to: process.env.MIOLO_LOG_MAIL_TO || 'noreply@mail.com'
232
- }
233
- },
234
- mail: {
235
- silent: process.env.MIOLO_MAILER_SILENT === 'true',
236
- options: {
237
- //
238
- // General options
239
- //
240
- // portis the port to connect to (defaults to 587 is secure is false or 465 if true)
241
- port: parseInt(process.env.MIOLO_MAILER_PORT || 25),
242
- // host is the hostname or IP address to connect to (defaults to ‘localhost’)
243
- host: process.env.MIOLO_MAILER_HOST || 'mail.com',
244
- // auth – defines authentication data
245
- // If authentication data is not present, the connection is considered authenticated from the start.
246
- // Otherwise you would need to provide the authentication options object.
247
- // - type indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’
248
- // - user is the username
249
- // - pass is the password for the user if normal login is used
250
- // authMethod – defines preferred authentication method, defaults to ‘PLAIN’
251
- authMethod: process.env.MIOLO_MAILER_AUTH_METHOD || 'PLAIN',
252
- ... process.env.MIOLO_MAILER_AUTH_METHOD === 'LOGIN'
253
- ? {
254
- auth: {
255
- user: process.env.MIOLO_MAILER_SMTP_USER || 'noreply@mail.com',
256
- pass: process.env.MIOLO_MAILER_SMTP_PASS || '****',
257
- type: 'login',
239
+ silent: process.env.MIOLO_MAILER_SILENT === 'true',
240
+ options: {
241
+ //
242
+ // General options
243
+ //
244
+ // port is the port to connect to (defaults to 587 is secure is false or 465 if true)
245
+ port: parseInt(process.env.MIOLO_MAILER_PORT || 25),
246
+ // host – is the hostname or IP address to connect to (defaults to ‘localhost’)
247
+ host: process.env.MIOLO_MAILER_HOST || 'mail.com',
248
+ // auth – defines authentication data
249
+ // If authentication data is not present, the connection is considered authenticated from the start.
250
+ // Otherwise you would need to provide the authentication options object.
251
+ // - type indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’
252
+ // - user is the username
253
+ // - pass is the password for the user if normal login is used
254
+ // authMethoddefines preferred authentication method, defaults to ‘PLAIN’
255
+ authMethod: process.env.MIOLO_MAILER_AUTH_METHOD || 'PLAIN',
256
+ ... process.env.MIOLO_MAILER_AUTH_METHOD === 'LOGIN'
257
+ ? {
258
+ auth: {
259
+ user: process.env.MIOLO_MAILER_SMTP_USER || 'noreply@mail.com',
260
+ pass: process.env.MIOLO_MAILER_SMTP_PASS || '****',
261
+ type: 'login',
262
+ },
263
+ secure: true,
264
+ }
265
+ : {
266
+ secure: false
258
267
  },
259
- secure: true,
260
- }
261
- : {
262
- secure: false
263
- },
264
268
 
265
- //
266
- // TLS options
267
- //
268
- // secure – if true the connection will use TLS when connecting to server.
269
- // If false (the default) then TLS is used if server supports the STARTTLS extension.
270
- // In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false
271
- // ** Setting secure to false does not mean that you would not use an encrypted connection. Most SMTP servers allow
272
- // connection upgrade via STARTTLS command but to use this you have to connect using plaintext first
273
-
269
+ //
270
+ // TLS options
271
+ //
272
+ // secure – if true the connection will use TLS when connecting to server.
273
+ // If false (the default) then TLS is used if server supports the STARTTLS extension.
274
+ // In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false
275
+ // ** Setting secure to false does not mean that you would not use an encrypted connection. Most SMTP servers allow
276
+ // connection upgrade via STARTTLS command but to use this you have to connect using plaintext first
274
277
 
275
- // tls – defines additional node.js TLSSocket options to be passed to the socket constructor, eg. {rejectUnauthorized: true}.
276
- tls: {
277
- // do not fail on invalid certs
278
- rejectUnauthorized: false
279
- } ,
280
- // ignoreTLS – if this is true and secure is false then TLS is not used even if the server supports STARTTLS extension
281
- // ** ignoreTLS: false,
282
- // requireTLS if this is true and secure is false then Nodemailer tries to use STARTTLS even
283
- // if the server does not advertise support for it. If the connection can not be encrypted then message is not sent
284
- // ** requireTLS: true,
285
- //
286
- // Connection options
287
- //
288
- // name – optional hostname of the client, used for identifying to the server, defaults to hostname of the machine
289
- // ** name: ,
290
- // localAddress is the local interface to bind to for network connections
291
- // ** localAddress: ,
292
- // connectionTimeout how many milliseconds to wait for the connection to establish
293
- // ** connectionTimeout: ,
294
- // greetingTimeout how many milliseconds to wait for the greeting after connection is established
295
- // ** greetingTimeout: ,
296
- // socketTimeout how many milliseconds of inactivity to allow
297
- // ** socketTimeout: ,
298
- //
299
- // Debug options
300
- //
301
- // logger – optional bunyan compatible logger instance. If set to true then logs to console.
302
- // If value is not set or is false then nothing is logged
303
- logger: false,
304
- // debug – if set to true, then logs SMTP traffic, otherwise logs only transaction events
305
- debug: false,
306
- //
307
- // Security options
308
- //
309
- // disableFileAccess – if true, then does not allow to use files as content.
310
- // Use it when you want to use JSON data from untrusted source as the email.
311
- // If an attachment or message node tries to fetch something from a file the sending returns an error
312
- ////disableFileAccess: ,
313
- // disableUrlAccess – if true, then does not allow to use Urls as content
314
- // ** disableUrlAccess: ,
278
+
279
+ // tls – defines additional node.js TLSSocket options to be passed to the socket constructor, eg. {rejectUnauthorized: true}.
280
+ tls: {
281
+ // do not fail on invalid certs
282
+ rejectUnauthorized: false
283
+ } ,
284
+ // ignoreTLS – if this is true and secure is false then TLS is not used even if the server supports STARTTLS extension
285
+ // ** ignoreTLS: false,
286
+ // requireTLS if this is true and secure is false then Nodemailer tries to use STARTTLS even
287
+ // if the server does not advertise support for it. If the connection can not be encrypted then message is not sent
288
+ // ** requireTLS: true,
289
+ //
290
+ // Connection options
291
+ //
292
+ // name – optional hostname of the client, used for identifying to the server, defaults to hostname of the machine
293
+ // ** name: ,
294
+ // localAddress – is the local interface to bind to for network connections
295
+ // ** localAddress: ,
296
+ // connectionTimeout – how many milliseconds to wait for the connection to establish
297
+ // ** connectionTimeout: ,
298
+ // greetingTimeout – how many milliseconds to wait for the greeting after connection is established
299
+ // ** greetingTimeout: ,
300
+ // socketTimeout – how many milliseconds of inactivity to allow
301
+ // ** socketTimeout: ,
302
+ //
303
+ // Debug options
304
+ //
305
+ // logger optional bunyan compatible logger instance. If set to true then logs to console.
306
+ // If value is not set or is false then nothing is logged
307
+ logger: false,
308
+ // debug – if set to true, then logs SMTP traffic, otherwise logs only transaction events
309
+ debug: false,
310
+ //
311
+ // Security options
312
+ //
313
+ // disableFileAccess if true, then does not allow to use files as content.
314
+ // Use it when you want to use JSON data from untrusted source as the email.
315
+ // If an attachment or message node tries to fetch something from a file the sending returns an error
316
+ ////disableFileAccess: ,
317
+ // disableUrlAccess – if true, then does not allow to use Urls as content
318
+ // ** disableUrlAccess: ,
315
319
 
316
- //
317
- // Pooling options
318
- //
319
- // pool – see Pooled SMTP for details about connection pooling : https://nodemailer.com/smtp/pooled/
320
- //
321
- // Proxy options
322
- //
323
- // proxy – all SMTP based transports allow to use proxies for making TCP connections to servers.
324
- // Read about proxy support in Nodemailer from here: https://nodemailer.com/smtp/proxies/
325
- },
326
- defaults: {
327
- name: process.env.MIOLO_NAME || 'miolo',
328
- from: process.env.MIOLO_MAILER_FROM || 'noreply@mail.com',
329
- to: process.env.MIOLO_MAILER_TO || 'noreply@mail.com'
330
- }
331
- },
332
- auth: {
333
- //basic: {
334
- // auth_user: async (username, password) => { return {id: 1} },
335
- // realm: '',
336
- // paths: [],
337
- //},
338
- //credentials: {
339
- // get_user_id: (user, done, miolo) => done(null, user.id), // default
340
- // find_user_by_id: (id, done, miolo) => done(null, {id: 1}), // ok=> done(null, user) err=> done(error, null)
341
- // local_auth_user: (username, password, done, miolo) => done(null, {id: 1})
342
- // // auth=> done(null, user) noauth=> done(null, false, {message: ''}) err=> done(error, null)
343
- // url_login : '/login',
344
- // url_logout: '/logout',
345
- // url_login_redirect: undefined
346
- // url_logout_redirect: '/'
347
- //}
348
- //guest: {
349
- // make_guest_token: undefined // (session) => ''
350
- //},
351
- //custom: callback,
352
- // here callback receives (app)
353
- // and returns:
354
- // - a middleware function
355
- // or
356
- // - an array like [{
357
- // method: 'GET' // POST,...
358
- // url: '/aa/bb',
359
- // callback: a middleware function
360
- // }, ...]
361
- },
362
-
363
- middlewares: [
364
- // async (ctx, next) => {}
365
- // Remember to call `await next()`
366
- ],
367
- cron: [
368
- // {
369
- // name,
370
- // cronTime,
371
- // onTick: async (miolo, onComplete),
372
- // Notice that if task runs too fast, you may see that
373
- // onTick is actually never run, but onComplete is.
374
- // Consider passing a higher interval on cronTime
375
- // onComplete: async (miolo),
376
- // timezone, context, runOnInit, utcOffset, unrefTimeout
377
- // }
378
- // check https://github.com/kelektiv/node-cron#readme
379
- //
380
- // https://crontab.guru/
381
- ],
382
-
383
- cache: {
384
- // Default options passed to cacheiro for
385
- // every other cache
386
- default: {
387
- type: 'combined',
388
- redis: {
389
- host: '127.0.0.1',
390
- port: 6379
320
+ //
321
+ // Pooling options
322
+ //
323
+ // pool – see Pooled SMTP for details about connection pooling : https://nodemailer.com/smtp/pooled/
324
+ //
325
+ // Proxy options
326
+ //
327
+ // proxy – all SMTP based transports allow to use proxies for making TCP connections to servers.
328
+ // Read about proxy support in Nodemailer from here: https://nodemailer.com/smtp/proxies/
391
329
  },
392
- version: parseInt(process.env.MIOLO_CACHE_VERSION || 1),
393
- clean: false,
330
+ defaults: {
331
+ name: process.env.MIOLO_NAME || 'miolo',
332
+ from: process.env.MIOLO_MAILER_FROM || 'noreply@mail.com',
333
+ to: process.env.MIOLO_MAILER_TO || 'noreply@mail.com'
334
+ }
394
335
  },
395
-
396
- // specific cache options for calustra
397
- calustra: {
398
- namespace: 'miolo-calustra',
399
- ttl: parseInt(process.env.MIOLO_CACHE_CALUSTRA_TTL || 86400*1000),
400
- version: parseInt(process.env.MIOLO_CACHE_CALUSTRA_VERSION || process.env.MIOLO_CACHE_VERSION || 1)
336
+ auth: {
337
+ //basic: {
338
+ // auth_user: async (username, password) => { return {id: 1} },
339
+ // realm: '',
340
+ // paths: [],
341
+ //},
342
+ //credentials: {
343
+ // get_user_id: (user, done, miolo) => done(null, user.id), // default
344
+ // find_user_by_id: (id, done, miolo) => done(null, {id: 1}), // ok=> done(null, user) err=> done(error, null)
345
+ // local_auth_user: (username, password, done, miolo) => done(null, {id: 1})
346
+ // // auth=> done(null, user) noauth=> done(null, false, {message: ''}) err=> done(error, null)
347
+ // url_login : '/login',
348
+ // url_logout: '/logout',
349
+ // url_login_redirect: undefined
350
+ // url_logout_redirect: '/'
351
+ //}
352
+ //guest: {
353
+ // make_guest_token: undefined // (session) => ''
354
+ //},
355
+ //custom: callback,
356
+ // here callback receives (app)
357
+ // and returns:
358
+ // - a middleware function
359
+ // or
360
+ // - an array like [{
361
+ // method: 'GET' // POST,...
362
+ // url: '/aa/bb',
363
+ // callback: a middleware function
364
+ // }, ...]
401
365
  },
402
366
 
403
- // specific cache options for koa-session
404
- session: {
405
- namespace: 'miolo-session',
406
- ttl: parseInt(process.env.MIOLO_CACHE_SESSION_TTL || process.env.MIOLO_SESSION_MAX_AGE || SESSION_MAX_AGE),
407
- version: parseInt(process.env.MIOLO_CACHE_SESSION_VERSION || process.env.MIOLO_CACHE_VERSION || 1)
408
- },
409
-
410
- // custom cache instances
411
- // will be inited by miolo, and available through ctx.miolo.cache.get_cache('name')
412
- custom: {
413
- // <name>: {options}
414
- }
367
+ middlewares: [
368
+ // async (ctx, next) => {}
369
+ // Remember to call `await next()`
370
+ ],
371
+ cron: [
372
+ // {
373
+ // name,
374
+ // cronTime,
375
+ // onTick: async (miolo, onComplete),
376
+ // Notice that if task runs too fast, you may see that
377
+ // onTick is actually never run, but onComplete is.
378
+ // Consider passing a higher interval on cronTime
379
+ // onComplete: async (miolo),
380
+ // timezone, context, runOnInit, utcOffset, unrefTimeout
381
+ // }
382
+ // check https://github.com/kelektiv/node-cron#readme
383
+ //
384
+ // https://crontab.guru/
385
+ ],
415
386
 
387
+ cache: {
388
+ // Default options passed to cacheiro for
389
+ // every other cache
390
+ default: {
391
+ type: 'combined',
392
+ redis: {
393
+ host: '127.0.0.1',
394
+ port: 6379
395
+ },
396
+ version: parseInt(process.env.MIOLO_CACHE_VERSION || 1),
397
+ clean: false,
398
+ },
399
+
400
+ // specific cache options for calustra
401
+ calustra: {
402
+ namespace: 'miolo-calustra',
403
+ ttl: parseInt(process.env.MIOLO_CACHE_CALUSTRA_TTL || 86400*1000),
404
+ version: parseInt(process.env.MIOLO_CACHE_CALUSTRA_VERSION || process.env.MIOLO_CACHE_VERSION || 1)
405
+ },
416
406
 
417
- },
407
+ // specific cache options for koa-session
408
+ session: {
409
+ namespace: 'miolo-session',
410
+ ttl: parseInt(process.env.MIOLO_CACHE_SESSION_TTL || process.env.MIOLO_SESSION_MAX_AGE || SESSION_MAX_AGE),
411
+ version: parseInt(process.env.MIOLO_CACHE_SESSION_VERSION || process.env.MIOLO_CACHE_VERSION || 1)
412
+ },
413
+
414
+ // custom cache instances
415
+ // will be inited by miolo, and available through ctx.miolo.cache.get_cache('name')
416
+ custom: {
417
+ // <name>: {options}
418
+ }
418
419
 
419
- socket: {
420
- enabled: false,
421
- cli: {
422
- /**
423
- domain: '',
424
- options: {}
425
- */
426
- }
427
- /*
428
- connection: (socket) => {},
429
- new_namespace: (namespace) => {},
430
- namespaces: [{
431
- name,
432
- listener: (data) => {}
433
- }]
434
- */
435
- },
436
420
 
437
- build: {
438
-
439
- client: process.env.NODE_ENV === 'production'
440
- ? `${process.env.MIOLO_BUILD_CLIENT_DEST}/${process.env.MIOLO_NAME}.${process.env.MIOLO_BUNDLE_SUFFIX}.js`
441
- : process.env.MIOLO_BUILD_CLIENT_ENTRY,
442
-
443
- html: process.env.MIOLO_BUILD_HTML_FILE,
421
+ },
444
422
 
445
- vite: {
446
- base: '/',
447
- root: '',
448
- watch: {
449
- // During tests we edit the files too fast and sometimes chokidar
450
- // misses change events, so enforce polling for consistency
451
- usePolling: true,
452
- interval: 100,
453
- },
423
+ socket: {
424
+ enabled: false,
425
+ cli: {
426
+ /**
427
+ domain: '',
428
+ options: {}
429
+ */
430
+ }
431
+ /*
432
+ connection: (socket) => {},
433
+ new_namespace: (namespace) => {},
434
+ namespaces: [{
435
+ name,
436
+ listener: (data) => {}
437
+ }]
438
+ */
454
439
  },
440
+
441
+ build: {
455
442
 
456
- ssr: {
457
- server: process.env.NODE_ENV === 'production'
458
- ? path.join(process.cwd(), `${process.env.MIOLO_BUILD_SERVER_DEST}/entry-server.js`)
459
- : process.env.MIOLO_BUILD_SERVER_SSR_ENTRY
460
- // loader: async (ctx) => {}
461
- },
443
+ client: process.env.NODE_ENV === 'production'
444
+ ? `${process.env.MIOLO_BUILD_CLIENT_DEST}/${process.env.MIOLO_NAME}.${process.env.MIOLO_BUILD_CLIENT_SUFFIX}.js`
445
+ : process.env.MIOLO_BUILD_CLIENT_ENTRY,
446
+
447
+ html: process.env.MIOLO_BUILD_HTML_FILE || './src/cli/index.html',
462
448
 
463
- dev: {
464
- watcher: {
465
- enabled: process.env.MIOLO_DEV_WATCH_ENABLED==='true',
466
- dirs: process.env.MIOLO_DEV_WATCH_DIRS.split(',').map(dir => path.join(process.cwd(), dir)),
449
+ vite: {
450
+ base: '/',
451
+ root: '',
452
+ watch: {
453
+ // During tests we edit the files too fast and sometimes chokidar
454
+ // misses change events, so enforce polling for consistency
455
+ usePolling: true,
456
+ interval: 100,
457
+ },
467
458
  },
459
+
460
+ ssr: {
461
+ server: process.env.NODE_ENV === 'production'
462
+ ? path.join(process.cwd(), `${process.env.MIOLO_BUILD_SERVER_DEST}/entry-server.js`)
463
+ : process.env.MIOLO_BUILD_SERVER_SSR_ENTRY
464
+ // loader: async (ctx) => {}
465
+ },
466
+
467
+ dev: {
468
+ watcher: {
469
+ enabled: process.env.MIOLO_DEV_WATCH_ENABLED==='true',
470
+ dirs: process.env.MIOLO_DEV_WATCH_DIRS?.split(',')?.map(dir => path.join(process.cwd(), dir)) || [],
471
+ },
472
+ }
468
473
  }
469
474
  }
470
- };
475
+ }
476
+
471
477