private String replaceProp(final String yamlStr,
                               final Map<String, Object> parentMap,
                               final String key,
                               final String newValue) {
        Objects.requireNonNull(parentMap);
        Objects.requireNonNull(key);
        Objects.requireNonNull(newValue);
        final String currValue = (String) parentMap.get(key);

        Objects.requireNonNull(currValue, () ->
                LogUtil.message("Can't find key '{}'", key));

        final Pattern pattern = Pattern.compile(
                "(^\\s*" + Pattern.quote(key) + ": +)" // Key
                + "(\"?)(" + Pattern.quote(currValue) + ")(\"?)" // Value
                + "( *| *#[^\n]+)?$", // optional comment at the end
                Pattern.MULTILINE);

        final Matcher matcher = pattern.matcher(yamlStr);
        return matcher.replaceAll(matchResult -> {
            final String wholeMatch = matchResult.group(0);
            final String keyPart = matchResult.group(1);
            final String leftQuote = matchResult.group(2);
            final String rightQuote = matchResult.group(4);
            final String commentPart = matchResult.group(5);
            final String replacement = keyPart + leftQuote + newValue + rightQuote + commentPart;
            //noinspection EscapedSpace
            log("""
                    \s   Replacing
                    \s     '{}' with
                    \s     '{}""", ConsoleColour.cyan(wholeMatch), ConsoleColour.cyan(replacement));
            return Matcher.quoteReplacement(replacement);
        });
    }
Do a hacky string replace as if we modify the map representation of the yaml
and write it back to a string we lose any commented stuff and it changes loads
of lines when we only really want to change a few.
stroom-test-common/src/main/java/stroom/test/common/util/db/SetupDevEnv.java