diff --git a/README.md b/README.md index 011170cf7..b6089e98b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # @unraid/api -Unraid API - ## Installation Ensure you have the latest version of the unraid.net plugin. @@ -10,6 +8,35 @@ This script should be run automatically on every boot. /etc/rc.d/rc.unraid-api install ``` +## CLI + +If you're on a unraid v6.9.0 or later machine this should be avaliable by running `unraid-api` in any directory. + +```bash +root@Devon:~# unraid-api + +Unraid API + + Thanks for using the official Unraid API + +Usage: + + $ unraid-api command + +Options: + + -h, --help Prints this usage guide. + -d, --debug Enabled debug mode. + -p, --port string Set the graphql port. + --environment production/staging/development Set the working environment. + --log-level error/warn/info/debug/trace/silly Set the log level. + --log-transport console/syslog Set the log transport. (default=syslog) + -v, --version Show version. + + Copyright © 2021 Lime Technology, Inc. + +``` + ## Connecting ### HTTP @@ -24,12 +51,18 @@ If you're using the ApolloClient please see https://github.com/apollographql/sub If installed on a unraid machine logs can be accessed via syslog. -Debug logs can be enabled via stdout while running with `start-debug`. +Log levels can be changed on start using the `--log-level` flag like so `--log-level=info/debug/silly/trace`. + +## Debug mode + +Debug mode can be enabled with the `-d` or `--debug` flag. +This will enable debug logs and the playground. + ## Playground -The playground can be access via `http://tower.local/graphql` while `PLAYGROUND=true` and `INTROSPECTION=true`. These values can be set in the `ecosystem.config.js` file in `/usr/local/bin/node/unraid-api`. -To get your API key open a terminal on your server and run `cat /boot/config/plugins/Unraid.net/myservers.cfg | grep apikey= | cut -d '"' -f2`. Add that api key in the "HTTP headers" panel of the playground. +The playground can be access via `http://tower.local/graphql` while in debug mode. +To get your API key open a terminal on your server and run `cat /boot/config/plugins/Unraid.net/myservers.cfg | grep apikey= | cut -d '"' -f2`. Add that API key in the "HTTP headers" panel of the playground. ```json { @@ -51,7 +84,7 @@ You should get something like this back. { "data": { "welcome": { - "message": "Welcome root to this Unraid 6.8.0 server" + "message": "Welcome root to this Unraid 6.9.0 server" } } } @@ -66,14 +99,14 @@ For exploring the schema visually I'd suggest using [Voyager](https://apis.guru/ ```bash NCHAN=disable \ # Disable nchan polling MOTHERSHIP_RELAY_WS_LINK=ws://localhost:8000 \ # Switch to local copy of mothership - DEBUG=true \ # Enable debug logging PATHS_UNRAID_DATA=$(pwd)/dev/data \ # Where we store plugin data (e.g. permissions.json) PATHS_STATES=$(pwd)/dev/states \ # Where .ini files live (e.g. vars.ini) PATHS_DYNAMIX_BASE=$(pwd)/dev/dynamix \ # Dynamix's data directory PATHS_DYNAMIX_CONFIG=$(pwd)/dev/dynamix/dynamix.cfg \ # Dynamix's config file + PATHS_MY_SERVERS_CONFIG=$(pwd)/dev/unraid.net/myservers.cfg \ # My servers config file PORT=8500 \ # What port unraid-api should start on (e.g. /var/run/unraid-api.sock or 8000) - node index.js + node dist/cli.js --debug # Enable debug logging ``` ## License -Copyright 2019 Lime Technology Inc. All rights reserved. +Copyright 2019-2021 Lime Technology Inc. All rights reserved.