Repository navigation
Expand file tree
/
Copy pathindex.js
More file actions
61 lines (58 loc) · 1.63 KB
/
Copy pathindex.js
File metadata and controls
61 lines (58 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
7996
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
module.exports.command = 'app'
module.exports.describe = 'Start an app unit.'
module.exports.builder = function(yargs) {
return yargs
.env('STF_APP')
.strict()
.option('auth-url', {
alias: 'a'
, describe: 'URL to the auth unit.'
, type: 'string'
, demand: true
})
.option('port', {
alias: 'p'
, describe: 'The port to bind to.'
, type: 'number'
, default: process.env.PORT || 7105
})
.option('secret', {
alias: 's'
, describe: 'The secret to use for auth JSON Web Tokens. Anyone who ' +
'knows this token can freely enter the system if they want, so keep ' +
'it safe.'
, type: 'string'
, default: process.env.SECRET
, demand: true
})
.option('ssid', {
alias: 'i'
, describe: 'The name of the session ID cookie.'
, type: 'string'
, default: process.env.SSID || 'ssid'
})
.option('user-profile-url', {
describe: 'URL to an external user profile page.'
, type: 'string'
})
.option('websocket-url', {
alias: 'w'
, describe: 'URL to the websocket unit.'
, type: 'string'
, demand: true
})
.epilog('Each option can be be overwritten with an environment variable ' +
'by converting the option to uppercase, replacing dashes with ' +
'underscores and prefixing it with `STF_APP_` (e.g. ' +
'`STF_APP_AUTH_URL`).')
}
module.exports.handler = function(argv) {
return require('../../units/app')({
port: argv.port
, secret: argv.secret
, ssid: argv.ssid
, authUrl: argv.authUrl
, websocketUrl: argv.websocketUrl
, userProfileUrl: argv.userProfileUrl
})
}