mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-29 11:54:04 +02:00
Merge pull request #2448 from alexbelgium/qbittorrent_debug_mode
Implement logging for OpenVPN with configurable level
This commit is contained in:
@@ -9,6 +9,10 @@ config["MySelf"]="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BA
|
||||
declare -a dns_servers_ipv4=()
|
||||
declare -a dns_servers_ipv6=()
|
||||
|
||||
log_level="$(bashio::config "log_level")"
|
||||
[[ "$log_level" == "debug" ]] && bashio::log.warning "--- Debug mode is active ---"
|
||||
[[ "$log_level" == "debug" ]] && set -x
|
||||
|
||||
_parse_config() {
|
||||
local -n config_ref="$1"
|
||||
local config_file="$2"
|
||||
@@ -348,12 +352,16 @@ _openvpn_up() {
|
||||
echo "${config["MySelf"]} openvpn postdown" >> ${config["PostDownScript"]}
|
||||
chmod 755 ${config["PostDownScript"]}
|
||||
|
||||
# Define logging
|
||||
log_path="/dev/null"
|
||||
[[ "$log_level" == "debug" ]] && log_path="/proc/1/fd/1"
|
||||
|
||||
# Start OpenVPN in the background
|
||||
_cmd "/usr/sbin/openvpn \
|
||||
--config "${config["ConfigFile"]}" \
|
||||
--client \
|
||||
--daemon \
|
||||
--log /dev/null \
|
||||
--log "$log_path" \
|
||||
--script-security 2 \
|
||||
--auth-user-pass "${OPENVPN_STATE_DIR}/credentials.conf" \
|
||||
--auth-retry none \
|
||||
|
||||
Reference in New Issue
Block a user