-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
63 lines (60 loc) · 1.28 KB
/
index.ts
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
import rc from 'rc';
import { OAuthConfig } from './types';
import { StoreType } from '../lib/stores/types';
import { stdSerializers } from 'bunyan';
import { oAuthSerializers } from '../lib/logger/serializers';
const { name } = require('../../package.json');
const defaultConfig: OAuthConfig = {
auth: {
register: {
maxPasswordLength: 100,
issuer: 'OAuth2-Server',
passwordRules: undefined
}
},
server: {
port: 8080,
log: {
name,
level: 'info',
serializers: {
...stdSerializers,
...oAuthSerializers
}
}
},
stores: {
authCode: StoreType.memory,
key: StoreType.memory,
credentials: StoreType.memory
},
dbs: {
redis: {
host: 'localhost',
port: 6379
}
},
services: {
mailer: {
type: 'sendgrid',
apiKey: '',
emailConfig: {
oneTimeSignIn: {
from: {
email: 'no-reply-auth@darrenmce.com',
name: 'OAuth 2 Server'
},
templateId: 'd-c52fd2e6fc22477fb800e02da5422b91'
}
}
}
}
};
let called = false;
export function getConfig(): OAuthConfig {
if (called) {
throw new Error('config was already loaded...');
}
called = true;
return rc(name, defaultConfig) as OAuthConfig;
}