diff --git a/docs/examples/docker-compose.example.yml b/docs/examples/docker-compose.example.yml
index b5ce8a30..b6f4a90b 100644
--- a/docs/examples/docker-compose.example.yml
+++ b/docs/examples/docker-compose.example.yml
@@ -13,17 +13,17 @@ services:
ports:
- 9000:9000/tcp
- # if you're using a reverse proxy, uncomment the next line:
+ # if you're using a reverse proxy, uncomment the next line and remove the one above (9000:9000/tcp):
#- 127.0.0.1:9000:9000
environment:
- # replace apiURL with your instance's target url in same format
- - apiURL=https://co.wuk.sh/
- # replace apiName with your instance's distinctive name
- - apiName=eu-nl
+ # replace https://co.wuk.sh/ with your instance's target url in same format
+ - API_URL=https://co.wuk.sh/
+ # replace eu-nl with your instance's distinctive name
+ - API_NAME=eu-nl
# if you want to use cookies when fetching data from services, uncomment the next line
- #- cookiePath=/cookies.json
- # see cookies_example.json for example file.
+ #- COOKIE_PATH=/cookies.json
+ # see cookies.example.json for example file.
labels:
- com.centurylinklabs.watchtower.scope=cobalt
@@ -43,14 +43,14 @@ services:
ports:
- 9001:9001/tcp
- # if you're using a reverse proxy, uncomment the next line:
+ # if you're using a reverse proxy, uncomment the next line and remove the one above (9001:9001/tcp):
#- 127.0.0.1:9001:9001
environment:
- # replace webURL with your instance's target url in same format
- - webURL=https://cobalt.tools/
- # replace apiURL with preferred api instance url
- - apiURL=https://co.wuk.sh/
+ # replace https://cobalt.tools/ with your instance's target url in same format
+ - WEB_URL=https://cobalt.tools/
+ # replace https://co.wuk.sh/ with preferred api instance url
+ - API_URL=https://co.wuk.sh/
labels:
- com.centurylinklabs.watchtower.scope=cobalt
diff --git a/docs/run-an-instance.md b/docs/run-an-instance.md
index 801895dc..5a181cc8 100644
--- a/docs/run-an-instance.md
+++ b/docs/run-an-instance.md
@@ -47,3 +47,25 @@ setup script installs all needed `npm` dependencies, but you have to install `no
sudo apt install nscd
sudo service nscd start
```
+
+## list of all environment variables
+### variables for api
+| variable name | default | example | description |
+|:----------------------|:----------|:------------------------|:------------|
+| `API_PORT` | `9000` | `9000` | changes port from which api server is accessible. |
+| `API_URL` | ➖ | `https://co.wuk.sh/` | changes url from which api server is accessible.
***REQUIRED TO RUN API***. |
+| `API_NAME` | `unknown` | `ams-1` | api server name that is shown in `/api/serverInfo`. |
+| `CORS_WILDCARD` | `1` | `0` | toggles cross-origin resource sharing.
`0`: disabled. `1`: enabled. |
+| `CORS_URL` | not used | `https://cobalt.tools/` | cross-origin resource sharing url. api will be available only from this url if `CORS_WILDCARD` is set to `0`. |
+| `COOKIE_PATH` | not used | `/cookies.json` | path for cookie file relative to main folder. |
+| `PROCESSING_PRIORITY` | not used | `10` | changes `nice` value* for ffmpeg subprocess. available only on unix systems. |
+
+\* the higher the nice value, the lower the priority. [read more here](https://en.wikipedia.org/wiki/Nice_(Unix)).
+
+### variables for web
+| variable name | default | example | description |
+|:--------------- |:--------|:------------------------|:--------------------------------------------------------------------------------------|
+| `WEB_PORT` | `9001` | `9001` | changes port from which frontend server is accessible. |
+| `WEB_URL` | ➖ | `https://cobalt.tools/` | changes url from which frontend server is accessible.
***REQUIRED TO RUN WEB***. |
+| `SHOW_SPONSORS` | `0` | `1` | toggles sponsor list in about popup.
`0`: disabled. `1`: enabled. |
+| `IS_BETA` | `0` | `1` | toggles beta tag next to cobalt logo.
`0`: disabled. `1`: enabled. |
diff --git a/src/cobalt.js b/src/cobalt.js
index 2d90e07e..050aec46 100644
--- a/src/cobalt.js
+++ b/src/cobalt.js
@@ -1,4 +1,5 @@
import "dotenv/config";
+import "./modules/sub/alias-envs.js";
import express from "express";
@@ -21,8 +22,8 @@ app.disable('x-powered-by');
await loadLoc();
-const apiMode = process.env.apiURL && !process.env.webURL;
-const webMode = process.env.webURL && process.env.apiURL;
+const apiMode = process.env.API_URL && !process.env.WEB_URL;
+const webMode = process.env.WEB_URL && process.env.API_URL;
if (apiMode) {
const { runAPI } = await import('./core/api.js');
diff --git a/src/core/api.js b/src/core/api.js
index 5f910315..8b359632 100644
--- a/src/core/api.js
+++ b/src/core/api.js
@@ -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.CORS_WILDCARD === '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?.CORS_WILDCARD === "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`
)
});
}
diff --git a/src/core/web.js b/src/core/web.js
index 08a6ffed..7c0cbf33 100644
--- a/src/core/web.js
+++ b/src/core/web.js
@@ -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`
)
})
}
diff --git a/src/modules/pageRender/elements.js b/src/modules/pageRender/elements.js
index a677d2bc..53ad3c42 100644
--- a/src/modules/pageRender/elements.js
+++ b/src/modules/pageRender/elements.js
@@ -264,5 +264,5 @@ export function sponsoredList() {
}
export function betaTag() {
- return process.env.isBeta ? 'β' : ''
+ return process.env.IS_BETA ? 'β' : ''
}
diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.js
index 81e6d514..77b87f29 100644
--- a/src/modules/pageRender/page.js
+++ b/src/modules/pageRender/page.js
@@ -48,10 +48,10 @@ export default function(obj) {