mirror of
https://github.com/hassio-addons/bashio.git
synced 2025-05-06 12:01:25 +00:00
Use different endpoint for add-on options (#88)
This commit is contained in:
parent
ee555d9afb
commit
8aa75b069b
2 changed files with 25 additions and 1 deletions
|
@ -544,6 +544,30 @@ function bashio::addon.option() {
|
|||
bashio::cache.flush_all
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Returns a JSON object with add-on specific config for the addon itself.
|
||||
#
|
||||
# This can be only used by self.
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::addon.config() {
|
||||
local cache_key="addons.self.options.config"
|
||||
local response
|
||||
|
||||
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
||||
|
||||
if bashio::cache.exists "${cache_key}"; then
|
||||
bashio::cache.get "${cache_key}"
|
||||
return "${__BASHIO_EXIT_OK}"
|
||||
fi
|
||||
|
||||
response=$(bashio::api.supervisor GET "/addons/self/options/config" false)
|
||||
|
||||
bashio::cache.set "${cache_key}" "${response}"
|
||||
printf "%s" "${response}"
|
||||
|
||||
return "${__BASHIO_EXIT_OK}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Returns a list of ports which are exposed on the host network for this add-on.
|
||||
#
|
||||
|
|
|
@ -45,7 +45,7 @@ function bashio::config() {
|
|||
end
|
||||
QUERY
|
||||
|
||||
options=$(bashio::addon.options)
|
||||
options=$(bashio::addon.config)
|
||||
result=$(bashio::jq "${options}" "${query}")
|
||||
|
||||
if [[ "${result}" == "null" ]] && bashio::var.has_value "${default_value}";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue