Expose config.php settings to operators #154

Open
opened 2026-10-22 08:51:43 +00:00 by amras · 6 comments
Owner

Background

Nextcloud handles a lot of its configuration through the config/config.php file. This file is unfortunately editable both by administrators and by the application.

Normally, config files ought to be specified in the configs: and templated, so their features can be placed in the .env and exposed to the operator. However, this would make it read-only for the application, so this recipe uses the unconventional approach of placing config.php in the nextconfig volume.

When an operator wants to modify the options provided by config.php, they have to deploy the app, then modify the file in the config volume. (e.g. using abra app cmd <domain> app set_system_config <config> <value> ) This has substantial limitations, described below.

Motivation

  1. I want to be able to change (imortant aspects of) the config without a running deployment. In particular, when preparing a config for a new instance or when using higher-layer tools like alakazam.
  2. Config-in-volume runs counter to the conventions in most other recipes, where (nearly) all the config is stored and documented in .env. Nextcloud is already relatively complex to set up, so if we can keep the config similar to other deployments it would ease the burden on operators.
  3. The principle "keep documentation close to what it documents" is difficult to keep in this case, since the operator effectively has to cross reference the readme, abra.sh's commands, their own running config.php, and nextcloud's own documentation. If we keep the variables in the .env, we can document them through names or through #comments.
  4. Because the config.php is not readily visible, contains a mix of relevant and irrelevant options, and is set with a mix of runtime and config commands, it becomes harder to notice issues in the config.

Proposal

config/config.php can be extended by files named config/*.config.php, as described here.These files can (probably) be read-only, making them a good candidate for templated configs:. They also take precedence over application-generated config.php options.

I suggest we create a operator.config.php.tmpl, then move a couple of relevant options into .env.sample, like skeleton_directory and default_app.

### Background Nextcloud handles a lot of its configuration through the `config/config.php` file. This file is unfortunately editable both by administrators and by the application. Normally, config files ought to be specified in the `configs:` and templated, so their features can be placed in the `.env` and exposed to the operator. However, this would make it read-only for the application, so this recipe uses the unconventional approach of placing `config.php` in the `nextconfig` volume. When an operator wants to modify the options provided by `config.php`, they have to deploy the app, then modify the file in the config volume. (e.g. using `abra app cmd <domain> app set_system_config <config> <value>` ) This has substantial limitations, described below. ### Motivation 1. I want to be able to change (imortant aspects of) the config without a running deployment. In particular, when preparing a config for a new instance or when using higher-layer tools like alakazam. 2. Config-in-volume runs counter to the conventions in most other recipes, where (nearly) all the config is stored and documented in .env. Nextcloud is already relatively complex to set up, so if we can keep the config similar to other deployments it would ease the burden on operators. 3. The principle "keep documentation close to what it documents" is difficult to keep in this case, since the operator effectively has to cross reference the readme, abra.sh's commands, their own running config.php, and nextcloud's own documentation. If we keep the variables in the .env, we can document them through names or through #comments. 4. Because the config.php is not readily visible, contains a mix of relevant and irrelevant options, and is set with a mix of runtime and config commands, it becomes harder to notice issues in the config. ### Proposal `config/config.php` can be extended by files named `config/*.config.php`, as described [here](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#loading).These files can (probably) be read-only, making them a good candidate for templated `configs:`. They also take precedence over application-generated `config.php` options. I suggest we create a `operator.config.php.tmpl`, then move a couple of relevant options into `.env.sample`, like `skeleton_directory` and `default_app`.
amras added the enhancementquestion labels 2026-10-22 08:51:43 +00:00
Owner
  1. what are the pros/cons?
  2. would you like to work on that?
1. what are the pros/cons? 2. would you like to work on that?
Owner

Settings in config.php can be set with occ config:system:set <key> --value=<value>. And the recipe already has two wrapper functions for that in abra.sh: set_system_config and run_occ. You can set defaultapp with abra app cmd <domain> app set_system_config defaultapp "dashboard"

And for setting the skeleton_directory to an empty value, there is: abra app cmd <domain> app disable_skeletondirectory or this one for setting any value: abra app cmd <domain> app set_system_config skeletondirectory '/some/path'

Settings in `config.php` can be set with `occ config:system:set <key> --value=<value>`. And the recipe already has two wrapper functions for that in `abra.sh`: `set_system_config` and `run_occ`. You can set defaultapp with `abra app cmd <domain> app set_system_config defaultapp "dashboard"` And for setting the `skeleton_directory` to an empty value, there is: `abra app cmd <domain> app disable_skeletondirectory` or this one for setting any value: `abra app cmd <domain> app set_system_config skeletondirectory '/some/path'`
Owner

Shall we close this then?

Shall we close this then?
dannygroenewegen added the documentation label 2026-10-26 07:51:55 +00:00
Owner

Shall we close this then?

@amras Would abra app cmd <domain> app set_system_config <config> <value> resolve it for you?

We can keep this open to clarify this in the readme. We could link to Nextcloud Configuration Parameters for all parameters that can be configured with set_system_config

> Shall we close this then? @amras Would `abra app cmd <domain> app set_system_config <config> <value>` resolve it for you? We can keep this open to clarify this in the readme. We could link to [Nextcloud Configuration Parameters](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#default-parameters) for all parameters that can be configured with `set_system_config`
Author
Owner
  1. would you like to work on that?

I would like to work on this, since I believe it'll save me headaches for future clients. Unfortunately I can't promise I'll do so in a timely manner because of other priorities - and I believe others would benefit if this was changed in the meantime. So if anyone else has the motivation to poke at the problem I encourage it.

Would abra app cmd <domain> app set_system_config <config> <value> resolve it for you

I agree we should keep this option, because it gives operators flexibility to change undocumented parameters. However, I don't think this is a sufficient solution.

  1. I want to be able to change (imortant aspects of) the config without a running deployment. In particular, when preparing a config for a new instance or when using higher-layer tools like alakazam.
  2. Config-in-volume runs counter to the conventions in most other recipes, where (nearly) all the config is stored and documented in .env. Nextcloud is already relatively complex to set up, so if we can keep the config similar to other deployments it would ease the burden on operators.
  3. The principle "keep documentation close to what it documents" is difficult to keep in this case, since the operator effectively has to cross reference the readme, abra.sh's commands, their own running config.php, and nextcloud's own documentation. If we keep the variables in the .env, we can document them through names or through #comments.
  4. Because the config.php is not readily visible, contains a mix of relevant and irrelevant options, and is set with a mix of runtime and config commands, it becomes harder to notice issues in the config.
> 2. would you like to work on that? I would like to work on this, since I believe it'll save me headaches for future clients. Unfortunately I can't promise I'll do so in a timely manner because of other priorities - and I believe others would benefit if this was changed in the meantime. So if anyone else has the motivation to poke at the problem I encourage it. > Would `abra app cmd <domain> app set_system_config <config> <value>` resolve it for you I agree we should keep this option, because it gives operators flexibility to change undocumented parameters. However, I don't think this is a sufficient solution. 1. I want to be able to change (imortant aspects of) the config without a running deployment. In particular, when preparing a config for a new instance or when using higher-layer tools like alakazam. 2. Config-in-volume runs counter to the conventions in most other recipes, where (nearly) all the config is stored and documented in .env. Nextcloud is already relatively complex to set up, so if we can keep the config similar to other deployments it would ease the burden on operators. 3. The principle "keep documentation close to what it documents" is difficult to keep in this case, since the operator effectively has to cross reference the readme, abra.sh's commands, their own running config.php, and nextcloud's own documentation. If we keep the variables in the .env, we can document them through names or through #comments. 4. Because the config.php is not readily visible, contains a mix of relevant and irrelevant options, and is set with a mix of runtime and config commands, it becomes harder to notice issues in the config.
Owner

Thanks @amras for this explanation - now I see the light :) I'm also in favour of having a config file which can be prepared beforehand, is readable, represents the current configuration, can be put in version control, ...

So let's keep the issue open then. Can I ask you to update the description of the issue with a resume of your 1. - 4.? I like having the main issue comment being the "latest state of the discussions". This makes it so that people don't need to go through all discussions to know what's the latest state of the issue.

Thanks @amras for this explanation - now I see the light :) I'm also in favour of having a config file which can be prepared beforehand, is readable, represents the current configuration, can be put in version control, ... So let's keep the issue open then. Can I ask you to update the description of the issue with a resume of your 1. - 4.? I like having the main issue comment being the "latest state of the discussions". This makes it so that people don't need to go through all discussions to know what's the latest state of the issue.
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coop-cloud/nextcloud#154