From ce9e09c3a605b89a0f06cfde62816518e3f97c6c Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Mon, 16 Nov 2020 11:55:09 -0500 Subject: [PATCH] Add examples and update readme --- .dockerignore | 1 + README.md | 9 +++++---- examples/examples.md | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 examples/examples.md diff --git a/.dockerignore b/.dockerignore index d364e293..dcd6b228 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,3 +10,4 @@ config/currentCreds.json config/maloja.json config/spotify.json config/config.json +/examples diff --git a/README.md b/README.md index 3eb4a06e..7da8a774 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ A single-user, javascript app to scrobble your recent plays to [Maloja](https:// * Persists obtained credentials to file * Automatically refreshes authorization for unattended use * Implements back off behavior if no listening activity is detected after an interval (after 10 minutes of idle it will back off to a maximum of 5 minutes between checks) +* Displays running status and buffered log through web server ## Installation @@ -91,6 +92,8 @@ On first startup you may need to authorize Spotify by visiting a callback URL. T https://localhost:9078/authSpotify ``` +Connection status and a buffered log of the last 50 events can be viewed at the root url: `https://localhost:9078` + ### Running Directly ``` @@ -105,11 +108,9 @@ node index.js | `LOG_DIR` | Volume | `/home/node/app/logs` | | `PORT` | Port | 9078 | -EX +## Examples -``` -docker run ... -v /path/on/host/config:/home/node/app/config ... -``` +[See minimal configuration examples in the examples folder](https://github.com/FoxxMD/spotify-scrobbler/tree/master/examples) ## License diff --git a/examples/examples.md b/examples/examples.md new file mode 100644 index 00000000..ec8a13d6 --- /dev/null +++ b/examples/examples.md @@ -0,0 +1,36 @@ +# Minimal Configuration + +Examples assume you have registered a Spotify application with the default callback url of `http://localhost:9078/callback`. + +If you use another callback url or domain name you will need to specify at a minimum `SPOTIFY_REDIRECT_URI`. + +## Using Environmental Variables + +### Local +``` +SPOTIFY_CLIENT_ID=yourId SPOTIFY_CLIENT_SECRET=yourSecret MALOJA_URL=http://domain.tld MALOJA_API_KEY=1234 node index.js +``` + +### Dockerhub + +Note: I do not recommend running a container without a `config` volume specified or you will need to reauthorize the app everytime the container is rebuilt. + +``` +docker run -e "SPOTIFY_CLIENT_ID=yourId" -e "SPOTIFY_CLIENT_SECRET=yourSecret" -e "MALOJA_URL=http://domain.tld" -e "MALOJA_API_KEY=1234" foxxmd/spotify-scrobbler +``` + +## Using Configuration + +Reference the [example json configs.](https://github.com/FoxxMD/spotify-scrobbler/tree/master/config) + +### Local + +``` +node index.js +``` + +### Docker + +``` +docker run -v /path/on/host/config:/home/node/app/config foxxmd/spotify-scrobbler +``` -- 2.51.2