Comments in config.yaml to roll out config for multiple instance

Servus,
We would like to manage the global configurations of our Octoprint instances via Git.
We want to use a master branch in git. From this branch each Octoprint instance pulls and then does a rebase to merge the local information with the global information.
Therefore we need to embed the individual local settings in a comment block. Otherwise the rebase will not work automatically.
Unfortunately the comments disappear in the config.yaml file after restarting or changing settings. Comments are added according to the Ocotprint manual.
Attached is the excerpt from a config file.

server:
    commands:
        serverRestartCommand: sudo service octoprint restart
        systemRestartCommand: sudo shutdown -r now
        systemShutdownCommand: sudo shutdown -h now
# PROTECTED
    firstRun: true
# PROTECTED
    onlineCheck:
        enabled: true
    pluginBlacklist:
        enabled: true
# PROTECTED
    secretKey: "no default value"
# PROTECTED
    seenWizards:
        corewizard: 3
        telegram: 1
        tracking: null
temperature:
    profiles:
    -   bed: 100
        chamber: null
        extruder: 210
        name: ABS
    -   bed: 60
        chamber: null
        extruder: 180
        name: PLA
webcam:
    ffmpeg: /usr/bin/ffmpeg
    flipH: true
    flipV: true
    snapshot: http://127.0.0.1:8080/?action=snapshot
    stream: /webcam/?action=stream

What would be the correct procedure so that the comments in the config file are not deleted?

Thanks for your help

Rather than putting comments in a generated config why not make your own config defining which elements are "protected"?

Hi,

The idea was to just use the build in feature like rebase to have a simple cron job doing all the stuff.
Your suggestion would be to write a script which after a pull replaces the protected content in the config with the local?
The initial hope was to just use rebase without comments. But that fails when changing sections above and below because it then either wants to keep the local block or replace everything.

Is there in Octoprint the possibility to dump parts of the config.yaml into a separate file?

Thanks :slight_smile:

I might take a slightly different approach where you actually pull a shell script that runs the CLI commands to set whatever settings you want to be set globally. For example...

~/oprint/bin/octoprint config set "server.commands.serverRestartCommand" "sudo service octoprint restart"

There may even be a larger merge option using json parameters, but don't have any experience with that.

https://docs.octoprint.org/en/master/configuration/cli.html