Skip to content

Commit 5059ff1

Browse files
authored
Add Supervisor country (#165)
1 parent 445707a commit 5059ff1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/supervisor.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,26 @@ function bashio::supervisor.timezone() {
182182
fi
183183
}
184184

185+
# ------------------------------------------------------------------------------
186+
# Returns or sets the current country of the system.
187+
#
188+
# Arguments:
189+
# $1 Country to set (optional).
190+
# ------------------------------------------------------------------------------
191+
function bashio::supervisor.country() {
192+
local country=${1:-}
193+
194+
bashio::log.trace "${FUNCNAME[0]}:" "$@"
195+
196+
if bashio::var.has_value "${country}"; then
197+
channel=$(bashio::var.json country "${country}")
198+
bashio::api.supervisor POST /supervisor/options "${country}"
199+
bashio::cache.flush_all
200+
else
201+
bashio::supervisor 'supervisor.info.country' '.country'
202+
fi
203+
}
204+
185205
# ------------------------------------------------------------------------------
186206
# Returns the current logging level of the Supervisor.
187207
#

0 commit comments

Comments
 (0)