-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.js
139 lines (116 loc) · 4.96 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
const pack = require('./package')
const fs = require('fs')
const join = require('path').join
const config = {
url: process.env.CANNON_URL || 'http://localhost:8090',
host: process.env.CANNON_HOST || 'localhost',
port: process.env.CANNON_PORT || 8090
}
config.webapp = {
url: process.env.CANNON_WEBAPP_URL || 'https://app.sinfo.org'
}
config.deck = {
url: process.env.CANNON_EVENTDECK_URL || 'https://deck.sinfo.org/api'
}
config.upload = {
path: process.env.CANNON_UPLOAD_PATH || join(__dirname, '/cannon_uploads'),
maxSize: process.env.CANNON_UPLOAD_MAX_SIZE || 1048576 * 10, // 10 MB
cvsZipPath: process.env.CANNON_UPLOAD_CVSZIP_PATH || join(__dirname, `/CVS.zip`),
cvsZipAge: process.env.CANNON_UPLOAD_CVSZIP_AGE || 3600 * 1000, // 1 hour in miliseconds
cvsLinkPath: join(__dirname, `/CVSlink.zip`)
}
config.aws = {
storageRegion: process.env.CANNON_AWS_STORAGE_REGION || 'AWS_STORAGE_REGION',
storageDomain: process.env.CANNON_AWS_STORAGE_DOMAIN || 'AWS_STORAGE_DOMAIN',
storageKey: process.env.CANNON_AWS_STORAGE_KEY || 'AWS_STORAGE_KEY',
storageSecret: process.env.CANNON_AWS_STORAGE_SECRET || 'AWS_STORAGE_SECRET',
storageName: process.env.CANNON_AWS_STORAGE_NAME || 'AWS_STORAGE_NAME',
storageTest: process.env.CANNON_AWS_STORAGE_TEST || '/cannon/test/'
}
config.mongo = {
url: process.env.CANNON_MONGO_URL || 'mongodb://localhost:27018/cannon'
}
config.facebook = {
clientId: process.env.CANNON_FACEBOOK_APP_ID || 'YOUR APP ID',
clientSecret: process.env.CANNON_FACEBOOK_APP_SECRET || 'YOUR APP SECRET'
}
config.google = {
clientId: process.env.CANNON_GOOGLE_APP_ID || 'YOUR APP ID',
clientSecret: process.env.CANNON_GOOGLE_CLIENT_SECRET || 'YOUR CLIENT SECRET',
apiKey: process.env.CANNON_GOOGLE_API_KEY || 'YOUR API KEY',
channelId: process.env.CANNON_GOOGLE_CHANNEL_ID || 'YOUR CHANNEL ID'
}
config.linkedin = {
clientId: process.env.CANNON_LINKEDIN_CLIENT_ID || 'YOUR CLIENT ID',
clientSecret: process.env.CANNON_LINKEDIN_CLIENT_SECRET || 'YOUR CLIENT SECRET',
redirectUri: process.env.CANNON_LINKEDIN_REDIRECT_URI || 'http://localhost:4201/login/linkedin'
}
config.fenix = {
url: process.env.CANNON_FENIX_URL || 'https://fenix.tecnico.ulisboa.pt/api/fenix/v1/',
oauthUrl: process.env.CANNON_FENIX_OAUTH_URL || 'https://fenix.tecnico.ulisboa.pt/oauth/',
clientId: process.env.CANNON_FENIX_APP_ID || 'YOUR CLIENT_ID',
clientSecret: process.env.CANNON_FENIX_APP_SECRET || 'YOUR CLIENT_SECRET',
redirectUri: process.env.CANNON_FENIX_REDIRECT_URI || 'http://example.com/redirect'
}
config.microsoft = {
url: process.env.CANNON_MICROSOFT_URL || 'https://graph.microsoft.com',
authority: process.env.CANNON_MICROSOFT_AUTHORITY || 'https://login.microsoftonline.com/common',
clientId: process.env.CANNON_MICROSOFT_CLIENT_ID || 'MICROSOFT_CLIENT_ID',
clientSecret: process.env.CANNON_MICROSOFT_CLIENT_SECRET || 'MICROSOFT_APP_SECRET',
redirectUri: process.env.CANNON_MICROSOFT_REDIRECT_URI || 'http://localhost:4201/login/microsoft'
}
config.bunyan = {
name: pack.name,
level: process.env.CANNON_LOG_LEVEL || 'trace'
}
config.logs = {
path: process.env.CANNON_LOG_PATH || join(__dirname, '/tmp/logs/')
}
config.swagger = {
pathPrefixSize: 1,
apiVersion: pack.version,
basePath: config.url
}
// order lesser permissions to greater
config.auth = {
permissions: ['user', 'company', 'team', 'admin']
}
config.auth.paths = {
tokenKeys: {
pub: process.env.CANNON_TOKEN_PUBLIC_KEY || join(__dirname, '/keys/token.pub'),
priv: process.env.CANNON_TOKEN_PRIVATE_KEY || join(__dirname, '/keys/token.key')
}
}
config.auth.paths.refreshKeys = {
pub: process.env.CANNON_REFRESH_TOKEN_PUBLIC_KEY || config.auth.paths.tokenKeys.pub,
priv: process.env.CANNON_REFRESH_TOKEN_PRIVATE_KEY || config.auth.paths.tokenKeys.priv
}
config.auth.token = {
/**
* expiresIn: expressed in seconds or a string describing a time span
* using: zeit/ms https://github.com/zeit/ms
*/
expiresIn: process.env.CANNON_TOKEN_EXPIRATION || '7d',
privateKey: fs.readFileSync(config.auth.paths.tokenKeys.priv),
publicKey: fs.readFileSync(config.auth.paths.tokenKeys.pub),
algorithm: process.env.CANNON_TOKEN_ALGORITHM || 'RS256',
issuer: process.env.CANNON_TOKEN_ISSUER || 'cannon'
}
config.auth.internal = {
username: process.env.CANNON_INTERNAL_AUTH_USERNAME || 'YOUR INTERNAL AUTH USERNAME',
password: process.env.CANNON_INTERNAL_AUTH_PASSWORD || 'YOUR INTERNAL AUTH PASSWORD'
}
config.email = {
from: process.env.CANNON_EMAIL_FROM || 'SINFO <[email protected]>',
replyTo: process.env.CANNON_EMAIL_REPLY_TO || '[email protected]',
path: process.env.CANNON_EMAIL_PATH || '/usr/sbin/sendmail'
}
config.mailgun = {
apiKey: process.env.CANNON_MAILGUN_APIKEY || 'YOUR API KEY',
domain: process.env.CANNON_MAILGUN_DOMAIN || 'sinfo.org'
}
if (process.env.NODE_ENV === 'test') {
config.mongo.url = process.env.CANNON_MONGO_TEST_URL || 'mongodb://localhost:27018/cannon_test'
config.bunyan.level = process.env.CANNON_LOG_LEVEL_TEST || 'error'
}
module.exports = config