mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
convert analytics to TS
This commit is contained in:
1 parent
fb69cb4e10
commit
923de901c4
24 files changed
+11093
-211
No files matched your search
@@ -0,0 +1,30 @@
|
||||
function getOrFailed(key: string): string {
|
||||
if (!process.env[key]) {
|
||||
throw new Error(`Missing required environment variable: ${key}`)
|
||||
}
|
||||
return process.env[key] as string
|
||||
}
|
||||
|
||||
interface Config {
|
||||
host: string
|
||||
port: number
|
||||
db: string
|
||||
username: string
|
||||
password: string
|
||||
baseUrl: string
|
||||
}
|
||||
|
||||
const config: Config = {
|
||||
host: process.env.HOST || 'localhost',
|
||||
port: process.env.PORT ? parseInt(process.env.PORT) : 3001,
|
||||
db: process.env.MONGO_URL || 'mongodb://localhost:27017/odyssey-test',
|
||||
//username: getOrFailed('ADMIN_USERNAME'),
|
||||
username: 'wancat',
|
||||
//password: getOrFailed('ADMIN_PASSWORD'),
|
||||
password: 'InMatrix',
|
||||
baseUrl:
|
||||
process.env.BASE_URL ||
|
||||
`http://${process.env.HOST || 'localhost'}:${process.env.PORT ? parseInt(process.env.PORT) : 3001}`,
|
||||
}
|
||||
|
||||
export default config
|
||||
Reference in new issue
Block a user