/
default.cjs
128 lines (126 loc) · 3.9 KB
/
default.cjs
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
var path = require('path')
var fs = require('fs')
var winston = require('winston')
var containerized = require('containerized')()
const serverPort = process.env.PORT || 8081
// Required to know webpack port so that in dev we can build correct URLs
const clientPort = process.env.CLIENT_PORT || 8080
const API_PREFIX = '/api'
let domain
// If we build a specific staging instance
if (process.env.NODE_APP_INSTANCE === 'dev') {
domain = 'https://skeleton.dev.kalisio.xyz'
} else if (process.env.NODE_APP_INSTANCE === 'test') {
domain = 'https://skeleton.test.kalisio.xyz'
} else if (process.env.NODE_APP_INSTANCE === 'prod') {
domain = 'https://skeleton.planet.kalisio.xyz'
} else {
// Otherwise we are on a developer machine
if (process.env.NODE_ENV === 'development') {
domain = 'http://localhost:' + clientPort
} else {
domain = 'http://localhost:' + serverPort
}
}
// Override defaults if env provided
if (process.env.SUBDOMAIN) {
domain = 'https://skeleton.' + process.env.SUBDOMAIN
}
module.exports = {
// Proxy your API if using any.
// Also see /build/script.dev.js and search for "proxy api requests"
// https://github.com/chimurai/http-proxy-middleware
proxyTable: {},
domain,
host: process.env.HOSTNAME || 'localhost',
port: serverPort,
distPath: fs.existsSync(path.join(__dirname, '../../dist/pwa')) ? path.join(__dirname, '../../dist/pwa') : path.join(__dirname, '../../dist/spa'),
/* To enable HTTPS
https: {
key: path.join(__dirname, 'server.key'),
cert: path.join(__dirname, 'server.crt'),
port: process.env.HTTPS_PORT || 8084
},
*/
apiPath: API_PREFIX,
paginate: {
default: 10,
max: 50
},
authentication: {
secret: process.env.APP_SECRET || 'my secret',
path: API_PREFIX + '/authentication',
service: API_PREFIX + '/users',
entity: 'user',
authStrategies: [
'jwt',
'local'
],
local: {
usernameField: 'email',
passwordField: 'password'
},
jwtOptions: {
header: {
typ: 'access' // See https://tools.ietf.org/html/rfc7519#section-5.1
},
audience: process.env.SUBDOMAIN || 'kalisio', // The resource server where the token is processed
issuer: 'kalisio', // The issuing server, application or resource
algorithm: 'HS256', // See https://github.com/auth0/node-jsonwebtoken#jwtsignpayload-secretorprivatekey-options-callback
expiresIn: '1d'
},
passwordPolicy: {
minLength: 8,
maxLength: 128,
uppercase: true,
lowercase: true,
digits: true,
symbols: true,
prohibited: fs.readFileSync(path.join(__dirname, '10k_most_common_passwords.txt')).toString().split('\n'),
history: 5
},
defaultUsers: [
{
email: 'kalisio@kalisio.xyz',
password: 'Pass;word1',
/*
device: {
registrationId: 'xxx',
number: '+xxx',
platform: 'ANDROID'
}
*/
name: 'Kalisio'
}
],
// Required for OAuth2 to work correctly
cookie: {
enabled: true,
name: 'feathers-jwt',
httpOnly: false,
secure: (process.env.NODE_ENV === 'development' ? false : true)
},
authorisation: {
cache: {
maxUsers: 1000
}
}
},
logs: {
Console: {
format: winston.format.combine(winston.format.colorize(), winston.format.simple()),
level: (process.env.NODE_ENV === 'development' ? 'verbose' : 'info')
},
DailyRotateFile: {
format: winston.format.json(),
dirname: path.join(__dirname, '..', 'logs'),
filename: 'skeleton-%DATE%.log',
datePattern: 'YYYY-MM-DD',
maxFiles: '30d'
}
},
db: {
adapter: 'mongodb',
url: process.env.DB_URL || (containerized ? 'mongodb://mongodb:27017/skeleton' : 'mongodb://127.0.0.1:27017/skeleton')
}
}