Added log environment variables (#6)

* Added verbose env variables

- `LOG_DEBUG` or `LOG_VERBOSE` do not change anything it they are unset (same as before)
- `LOG_DEBUG` or `LOG_VERBOSE` take precedence on Plex configuration file at start when set to `0` or `1`. The user can change the Preferences once the container is started which will overwrite the environment variables.
This commit is contained in:
Quentin McGaw 2018-11-26 15:30:45 +02:00 committed by Adam Dodman
parent e283b21505
commit f9e4de3149
2 changed files with 22 additions and 0 deletions

View File

@ -59,6 +59,8 @@ Finally, navigate to [app.plex.tv/desktop](https://app.plex.tv/desktop) or [your
- `$ADVERTISE_IP` - This variable defines the additional IPs on which the server may be be found. For example: `http://10.1.1.23:32400`. This adds to the list where the server advertises that it can be found. - `$ADVERTISE_IP` - This variable defines the additional IPs on which the server may be be found. For example: `http://10.1.1.23:32400`. This adds to the list where the server advertises that it can be found.
- `$DISABLE_REMOTE_SEC` - - `$DISABLE_REMOTE_SEC` -
- `$PLEX_CLAIM` - The claim token for the server to obtain a real server token. If not provided, server will not be automatically logged in. If server is already logged in, this parameter is ignored. - `$PLEX_CLAIM` - The claim token for the server to obtain a real server token. If not provided, server will not be automatically logged in. If server is already logged in, this parameter is ignored.
- `$LOG_DEBUG` - Disables debug logging if set to 0, and enables it if set to 1. This overwrites preferences set in the Plex Web user interface.
- `$LOG_VERBOSE` - Disables logging (except warnings and errors) if set to 0, and enables it if set to 1. This overwrites preferences set in the Plex Web user interface.
### Network ### Network

View File

@ -51,6 +51,26 @@ if [ ! -e "\$PREF_FILE" ]; then
source gen-config.sh source gen-config.sh
fi fi
# Changes the log verbosity (Environment variable takes precedence on Plex Config)
if [ "$LOG_VERBOSE" = "1" ]; then
setPref "LogVerbose" "1"
elif [ "$LOG_VERBOSE" = "0" ]; then
setPref "LogVerbose" "0"
elif [ ! -z "$LOG_VERBOSE" ]; then
2>&1 echo -e "${RED}LOG_VERBOSE value '$LOG_VERBOSE' is invalid${RESET}"
exit 1
fi
# Changes the debug verbosity (Environment variable takes precedence on Plex Config)
if [ "$LOG_DEBUG" = "1" ]; then
setPref "logDebug" "1"
elif [ "$LOG_DEBUG" = "0" ]; then
setPref "logDebug" "0"
elif [ ! -z "$LOG_DEBUG" ]; then
2>&1 echo -e "${RED}LOG_DEBUG value '$LOG_DEBUG' is invalid${RESET}"
exit 1
fi
# Always attempt to claim an unclaimed server in case it was signed out # Always attempt to claim an unclaimed server in case it was signed out
token="\$(getPref "PlexOnlineToken")" token="\$(getPref "PlexOnlineToken")"
if [ ! -z "\${PLEX_CLAIM}" ] && [ -z "\${token}" ]; then if [ ! -z "\${PLEX_CLAIM}" ] && [ -z "\${token}" ]; then