mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
Default BONOB_WEB_ADDRESS to the hostname of the machine, error if localhost provided, clarify README.md.
This commit is contained in:
@@ -55,14 +55,14 @@ Bonob will now auto-register itself with sonos on startup, updating the registra
|
|||||||
item | default value | description
|
item | default value | description
|
||||||
---- | ------------- | -----------
|
---- | ------------- | -----------
|
||||||
BONOB_PORT | 4534 | Default http port for bonob to listen on
|
BONOB_PORT | 4534 | Default http port for bonob to listen on
|
||||||
BONOB_WEB_ADDRESS | http://localhost:4534 | URL for bonob so that sonos devices can communicate
|
BONOB_WEB_ADDRESS | http://$(hostname):4534 | URL for bonob so that sonos devices can communicate. **This must be either the public IP or DNS entry of the bonob instance so that the sonos devices can communicate with it.**
|
||||||
BONOB_SECRET | bonob | secret used for encrypting credentials
|
BONOB_SECRET | bonob | secret used for encrypting credentials
|
||||||
BONOB_SONOS_AUTO_REGISTER | false | Whether or not to try and auto-register on startup
|
BONOB_SONOS_AUTO_REGISTER | false | Whether or not to try and auto-register on startup
|
||||||
BONOB_SONOS_DEVICE_DISCOVERY | true | whether or not sonos device discovery should be enabled
|
BONOB_SONOS_DEVICE_DISCOVERY | true | whether or not sonos device discovery should be enabled
|
||||||
BONOB_SONOS_SEED_HOST | undefined | sonos device seed host for discovery, or ommitted for for auto-discovery
|
BONOB_SONOS_SEED_HOST | undefined | sonos device seed host for discovery, or ommitted for for auto-discovery
|
||||||
BONOB_SONOS_SERVICE_NAME | bonob | service name for sonos
|
BONOB_SONOS_SERVICE_NAME | bonob | service name for sonos
|
||||||
BONOB_SONOS_SERVICE_ID | 246 | service id for sonos
|
BONOB_SONOS_SERVICE_ID | 246 | service id for sonos
|
||||||
BONOB_NAVIDROME_URL | http://localhost:4533 | URL for navidrome
|
BONOB_NAVIDROME_URL | http://$(hostname):4533 | URL for navidrome
|
||||||
BONOB_NAVIDROME_CUSTOM_CLIENTS | undefined | Comma delimeted mime types for custom navidrome clients when streaming. ie. "audio/flac,audio/ogg" would use client = 'bonob+audio/flac' for flacs, and 'bonob+audio/ogg' for oggs.
|
BONOB_NAVIDROME_CUSTOM_CLIENTS | undefined | Comma delimeted mime types for custom navidrome clients when streaming. ie. "audio/flac,audio/ogg" would use client = 'bonob+audio/flac' for flacs, and 'bonob+audio/ogg' for oggs.
|
||||||
|
|
||||||
## Initialising service within sonos app
|
## Initialising service within sonos app
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"dev": "BONOB_PORT=4000 BONOB_WEB_ADDRESS=http://$(hostname):4000 nodemon ./src/app.ts",
|
"dev": "BONOB_PORT=4000 nodemon ./src/app.ts",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"client-test": "ts-node tests/bonob_client.ts"
|
"client-test": "ts-node tests/bonob_client.ts"
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/app.ts
10
src/app.ts
@@ -1,3 +1,4 @@
|
|||||||
|
import { hostname } from "os";
|
||||||
import sonos, { bonobService } from "./sonos";
|
import sonos, { bonobService } from "./sonos";
|
||||||
import server from "./server";
|
import server from "./server";
|
||||||
import logger from "./logger";
|
import logger from "./logger";
|
||||||
@@ -8,7 +9,12 @@ import { InMemoryLinkCodes } from "./link_codes";
|
|||||||
|
|
||||||
const PORT = +(process.env["BONOB_PORT"] || 4534);
|
const PORT = +(process.env["BONOB_PORT"] || 4534);
|
||||||
const WEB_ADDRESS =
|
const WEB_ADDRESS =
|
||||||
process.env["BONOB_WEB_ADDRESS"] || `http://localhost:${PORT}`;
|
process.env["BONOB_WEB_ADDRESS"] || `http://${hostname()}:${PORT}`;
|
||||||
|
|
||||||
|
if (WEB_ADDRESS.match("localhost")) {
|
||||||
|
logger.error("BONOB_WEB_ADDRESS containing localhost is almost certainly incorrect, sonos devices will not be able to communicate with bonob using localhost, please specify either public IP or DNS entry");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
const SONOS_DEVICE_DISCOVERY =
|
const SONOS_DEVICE_DISCOVERY =
|
||||||
(process.env["BONOB_SONOS_DEVICE_DISCOVERY"] || "true") == "true";
|
(process.env["BONOB_SONOS_DEVICE_DISCOVERY"] || "true") == "true";
|
||||||
@@ -42,7 +48,7 @@ const app = server(
|
|||||||
bonob,
|
bonob,
|
||||||
WEB_ADDRESS,
|
WEB_ADDRESS,
|
||||||
new Navidrome(
|
new Navidrome(
|
||||||
process.env["BONOB_NAVIDROME_URL"] || "http://localhost:4533",
|
process.env["BONOB_NAVIDROME_URL"] || `http://${hostname()}:4533`,
|
||||||
encryption(secret),
|
encryption(secret),
|
||||||
streamUserAgent
|
streamUserAgent
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user