Added commenting to YML file to alert users of UCI overwriting

pull/3/head
riley 12 months ago
parent 2d5fa7ae40
commit 1374f4ead9

@ -250,6 +250,21 @@ get_camera_index_by_name() {
done
}
# Toggles the line comment for a specific camera attribute in the YML
toggle_override() {
local name=$1
local attribute=$2
local current_comment=$(yq eval ".cameras.$name.$attribute | line_comment" /opt/docker2/compose/frigate/config.yml)
if [ "$current_comment" = "OVERWRITTEN_BY_UCI" ]; then
# If the current comment is "OVERWRITTEN_BY_UCI", remove it by setting it to nothing
yq eval ".cameras.$name.$attribute line_comment=\"\"" -i /opt/docker2/compose/frigate/config.yml
else
# Otherwise, set the comment to "OVERWRITTEN_BY_UCI"
yq eval ".cameras.$name.$attribute line_comment=\"OVERWRITTEN_BY_UCI\"" -i /opt/docker2/compose/frigate/config.yml
fi
}
update_camera_in_yml() {
local name=$1

Loading…
Cancel
Save