kgaughan / xml-safe-mod

A small utility for safely making updates to XML configuration files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xml-safe-mod

A small utility for safely making updates to XML configuration files.

It aims to give a safer alternative to using sed when updating XML configuration files, both by avoiding leaking secrets and by making the updates themselves safe and atomic.

Usage

# In-place update
echo '{"secret1": "password1"}' | xml-safe-mod --src /etc/daemon/config.xml --in-place --set secret1 ./xpath/expression
# Use a template file to generate another file
echo '{"secret1": "password1"}' | xml-safe-mod --src /etc/daemon/config.xml.in --dest /etc/daemon/config.xml --owner daemon --group daemon --perms 600 --set secret1 ./xpath/expression

It supports the ElementTree subset of XPath.

About

A small utility for safely making updates to XML configuration files

License:MIT License


Languages

Language:Python 91.1%Language:Shell 8.9%