-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.js
67 lines (63 loc) · 1.75 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
const pipe = require('ramda/src/pipe')
const path = require('ramda/src/path')
const pick = require('ramda/src/pick')
const reduce = require('ramda/src/reduce')
const toPairs = require('ramda/src/toPairs')
const assocPath = require('ramda/src/assocPath')
const __ = require('ramda/src/__')
var config = {
authentication: {
strategies: [
'local',
'jwt',
'oauth2'
],
service: 'credentials',
entity: 'credential',
local: {
service: 'credentials',
entity: 'credential'
},
remote: {
google: {
type: 'oauth2',
Strategy: require('passport-google-oauth20').Strategy,
scope: ['profile', 'email'],
label: 'Google',
icon: 'fa fa-google',
backgroundColor: '#ffffff'
},
facebook: {
type: 'oauth2',
Strategy: require('passport-facebook').Strategy,
scope: ['public_profile', 'email'],
profileFields: ['id', 'displayName', 'photos', 'email'],
label: 'Facebook',
icon: 'fa fa-facebook',
backgroundColor: '#3b5998'
},
github: {
type: 'oauth2',
Strategy: require('passport-github').Strategy,
scope: ['user'],
label: 'GitHub',
icon: 'fa fa-github',
backgroundColor: '#6d6d6d'
}
}
}
}
// set browser config
const authRemotePath = ['authentication', 'remote']
const pickBrowserRemoteConfig = pick(['label', 'icon', 'backgroundColor'])
const getBrowserConfig = pipe(
path(authRemotePath),
toPairs,
reduce((sofar, [name, remote]) => {
const browserConfig = pickBrowserRemoteConfig(remote)
return assocPath([name], browserConfig, sofar)
}, {}),
assocPath(authRemotePath, __, {})
)
config.browser = getBrowserConfig(config)
module.exports = config