Problem

Editing a wp-config.php file programmatically is imprecise and error-prone, when it ideally would be as easy as running a WP-CLI command.

Proposed Algorithm

Borek Bernard has some suggestions for how to implement on Github.