mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 19:10:12 +08:00
feat: put survey and bug report url to backend (#57)
* feat: put survey and bug report url to backend * fix: centralize hardcoded url to config * fix: validate url before redirecting
This commit is contained in:
1 parent
f93b4d757b
commit
4c2f3f5397
8 files changed
+42
-5
No files matched your search
@@ -11,6 +11,14 @@ function getTrustProxies(key) {
|
||||
.filter((p) => validator.isIPRange(p) || validator.isIP(p))
|
||||
}
|
||||
|
||||
function getUrl(key) {
|
||||
const url = get(key, '')
|
||||
if (validator.isURL(url)) {
|
||||
return validator.trim(url)
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
const config = {
|
||||
host: get('HOST', 'localhost'),
|
||||
port: get('PORT', 3000),
|
||||
@@ -30,6 +38,8 @@ const config = {
|
||||
clientSecret: get('GITHUB_CLIENT_SECRET', ''),
|
||||
},
|
||||
trustedProxies: getTrustProxies('TRUSTED_PROXIES'),
|
||||
surveyUrl: getUrl('SURVEY_URL', ''),
|
||||
bugReportUrl: getUrl('BUG_REPORT_URL', ''),
|
||||
}
|
||||
|
||||
config.baseUrl = get('BASE_URL', `http://${config.host}:${config.port}`)
|
||||
|
||||
Reference in new issue
Block a user