env: readable environment variables in all files
apiPort -> API_PORT apiURL -> API_URL apiName -> API_NAME cors -> ENABLE_CORS cookiePath -> COOKIE_PATH webPort -> WEB_PORT webURL -> WEB_URL showSponsors -> SHOW_SPONSORS isBeta -> IS_BETA
This commit is contained in:
@@ -14,7 +14,7 @@ import { sha256 } from "../modules/sub/crypto.js";
|
||||
import { verifyStream } from "../modules/stream/manage.js";
|
||||
|
||||
export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
|
||||
const corsConfig = process.env.cors === '0' ? {
|
||||
const corsConfig = process.env.ENABLE_CORS === '0' ? {
|
||||
origin: process.env.CORS_URL,
|
||||
optionsSuccessStatus: 200
|
||||
} : {};
|
||||
@@ -141,9 +141,9 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
|
||||
version: version,
|
||||
commit: gitCommit,
|
||||
branch: gitBranch,
|
||||
name: process.env.apiName || "unknown",
|
||||
url: process.env.apiURL,
|
||||
cors: process.env?.cors === "0" ? 0 : 1,
|
||||
name: process.env.API_NAME || "unknown",
|
||||
url: process.env.API_URL,
|
||||
cors: process.env?.ENABLE_CORS === "0" ? 0 : 1,
|
||||
startTime: `${startTimestamp}`
|
||||
});
|
||||
default:
|
||||
@@ -169,12 +169,12 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
|
||||
res.redirect('/api/json')
|
||||
});
|
||||
|
||||
app.listen(process.env.apiPort || 9000, () => {
|
||||
app.listen(process.env.API_PORT || 9000, () => {
|
||||
console.log(`\n` +
|
||||
`${Cyan("cobalt")} API ${Bright(`v.${version}-${gitCommit} (${gitBranch})`)}\n` +
|
||||
`Start time: ${Bright(`${startTime.toUTCString()} (${startTimestamp})`)}\n\n` +
|
||||
`URL: ${Cyan(`${process.env.apiURL}`)}\n` +
|
||||
`Port: ${process.env.apiPort || 9000}\n`
|
||||
`URL: ${Cyan(`${process.env.API_URL}`)}\n` +
|
||||
`Port: ${process.env.API_PORT || 9000}\n`
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ export async function runWeb(express, app, gitCommit, gitBranch, __dirname) {
|
||||
return res.redirect('/')
|
||||
});
|
||||
|
||||
app.listen(process.env.webPort || 9001, () => {
|
||||
app.listen(process.env.WEB_PORT || 9001, () => {
|
||||
console.log(`\n` +
|
||||
`${Cyan("cobalt")} WEB ${Bright(`v.${version}-${gitCommit} (${gitBranch})`)}\n` +
|
||||
`Start time: ${Bright(`${startTime.toUTCString()} (${startTimestamp})`)}\n\n` +
|
||||
`URL: ${Cyan(`${process.env.webURL}`)}\n` +
|
||||
`Port: ${process.env.webPort || 9001}\n`
|
||||
`URL: ${Cyan(`${process.env.WEB_URL}`)}\n` +
|
||||
`Port: ${process.env.WEB_PORT || 9001}\n`
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user