mirror of
https://github.com/hassio-addons/bashio.git
synced 2025-05-06 20:11:24 +00:00
Fix default value handling for configuration options (#90)
This commit is contained in:
parent
256198ff88
commit
4d2fa76db6
1 changed files with 3 additions and 2 deletions
|
@ -12,10 +12,11 @@
|
|||
#
|
||||
# Arguments:
|
||||
# $1 Key of the config option
|
||||
# $2 Default value for not set config option (optional: defaults to 'null')
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::config() {
|
||||
local key=${1}
|
||||
local default_value=${2:-}
|
||||
local default_value=${2:-null}
|
||||
local query
|
||||
local result
|
||||
|
||||
|
@ -48,7 +49,7 @@ QUERY
|
|||
options=$(bashio::addon.config)
|
||||
result=$(bashio::jq "${options}" "${query}")
|
||||
|
||||
if [[ "${result}" == "null" ]] && bashio::var.has_value "${default_value}";
|
||||
if [[ "${result}" == "null" ]];
|
||||
then
|
||||
echo "${default_value}"
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue