-
-
Notifications
You must be signed in to change notification settings - Fork 373
Expand file tree
/
Copy pathConfig.ts
More file actions
74 lines (72 loc) · 1.67 KB
/
Copy pathConfig.ts
File metadata and controls
74 lines (72 loc) · 1.67 KB
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
import {Controller, Get} from '@overnightjs/core';
import type {Request, Response} from 'express';
import {
API_URI,
AWS_SES_REGION,
DASHBOARD_URI,
DISABLE_SIGNUPS,
GITHUB_OAUTH_ENABLED,
GOOGLE_OAUTH_ENABLED,
LANDING_URI,
MAIL_FROM_SUBDOMAIN,
NODE_ENV,
S3_ENABLED,
SMTP_DOMAIN,
SMTP_ENABLED,
SMTP_PORT_SECURE,
SMTP_PORT_SUBMISSION,
STRIPE_ENABLED,
TRACKING_TOGGLE_ENABLED,
WIKI_URI,
} from '../app/constants.js';
@Controller('config')
export class Config {
/**
* GET /config
* Expose a unified view of instance capabilities and feature flags for frontends.
*/
@Get('')
public getConfig(req: Request, res: Response) {
return res.status(200).json({
environment: NODE_ENV,
urls: {
api: API_URI,
dashboard: DASHBOARD_URI,
landing: LANDING_URI,
wiki: WIKI_URI || null,
},
features: {
billing: {
enabled: STRIPE_ENABLED,
},
storage: {
s3Enabled: S3_ENABLED,
},
authProviders: {
github: GITHUB_OAUTH_ENABLED,
google: GOOGLE_OAUTH_ENABLED,
},
signup: {
signupsDisabled: DISABLE_SIGNUPS,
},
email: {
trackingToggleEnabled: TRACKING_TOGGLE_ENABLED,
},
smtp: {
enabled: SMTP_ENABLED,
domain: SMTP_ENABLED ? SMTP_DOMAIN : null,
ports: SMTP_ENABLED
? {
secure: SMTP_PORT_SECURE,
submission: SMTP_PORT_SUBMISSION,
}
: null,
},
},
aws: {
sesRegion: AWS_SES_REGION,
mailFromSubdomain: MAIL_FROM_SUBDOMAIN,
},
});
}
}