Configure Xwiki Programmatically for automatic deployment

I am trying to setup a fully preconfigured Xwiki instance, that can be deployed and doesn’t need any manual configuration afterwards. But I am having a hard time to configure some things.

For example, I want to have the wiki private by default, but haven’t found any switch in the config files or an API to do that yet.

Second example is a custom menu below the header that I need to be set up. Is there any way to do these things programmatically?

The only way I found to do this was to preconfigure an instance and then dump the preconfigured database, add that dump to the docker image and restore it at first startup of new instances. This is not very nice, but it works. However maybe there is a better solution?