Shell
You're viewing a free preview. Sign in free to read every script.
Why this exists Deployment scripts constantly change configuration: set a port, switch a URL, add a line if it is missing. Editing files with a script is risky, because a half written file or a wrong pattern can break a…
sed, envsubst and Editing Configuration Files Safely and Repeatably
Use sed for substitutions, deletions and inserts, write an idempotent set_config function that updates or adds a key, replace a file atomically with permissions preserved, and generate files from templates with envsubst without breaking variables like nginx uses.
Sign in free to read this script, along with the rest of the library.
Sign in free