mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +00:00
api: add API_LISTEN_ADDRESS env for specifying bind address
This commit is contained in:
parent
9332b2e196
commit
cc1e9dcff8
3 changed files with 3 additions and 1 deletions
|
@ -53,6 +53,7 @@ sudo service nscd start
|
|||
| variable name | default | example | description |
|
||||
|:----------------------|:----------|:------------------------|:------------|
|
||||
| `API_PORT` | `9000` | `9000` | changes port from which api server is accessible. |
|
||||
| `API_LISTEN_ADDRESS` | `0.0.0.0` | `127.0.0.1` | changes address from which api server is accessible. **if you are using docker, you usually don't need to configure this.** |
|
||||
| `API_URL` | ➖ | `https://co.wuk.sh/` | changes url from which api server is accessible. <br> ***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. <br> `0`: disabled. `1`: enabled. |
|
||||
|
|
|
@ -194,7 +194,7 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
|
|||
res.redirect('/api/json')
|
||||
});
|
||||
|
||||
app.listen(env.apiPort, () => {
|
||||
app.listen(env.apiPort, env.listenAddress, () => {
|
||||
console.log(`\n` +
|
||||
`${Cyan("cobalt")} API ${Bright(`v.${version}-${gitCommit} (${gitBranch})`)}\n` +
|
||||
`Start time: ${Bright(`${startTime.toUTCString()} (${startTimestamp})`)}\n\n` +
|
||||
|
|
|
@ -29,6 +29,7 @@ const
|
|||
apiEnvs = {
|
||||
apiPort: process.env.API_PORT || 9000,
|
||||
apiName: process.env.API_NAME || 'unknown',
|
||||
listenAddress: process.env.API_LISTEN_ADDRESS,
|
||||
corsWildcard: process.env.CORS_WILDCARD !== '0',
|
||||
corsURL: process.env.CORS_URL,
|
||||
cookiePath: process.env.COOKIE_PATH,
|
||||
|
|
Loading…
Reference in a new issue