Naming convention for array keys in config.php

In config/config.php I found keys in various styles:

  • alllowercasewhichishardtorad
  • separated_with_underscores
  • separated.with.dots
  • seperated.withDots.andCamelCase

Which one should I use when writing apps? Was this set or at least discussed?

You should put your configs into the appconfig (instead of the config.php file), and there you should use underscores.

1 Like

What exactly do you mean by “appconfig”? As far as I know I can only store app configuration inside the database. I am trying to avoid a UI for my app and therefore want to store configuration in a file.

Is there an alternative to using config/config.php?

Yeah I don’t know your App. Nevertheless app config is supposed to go into the database most of the times. It can also be configured via ./occ config:app:set in that case. Adding an interface which just sets some config values is actually not that hard (you can put it in the advanced settings tab):

Admin module:
Register the module:

You don’t need an endpoint which saves the value, as there is a general endpoint.

If you still don’t want to do that, looking at the config.php . seems to be the currently used method.

but this requires an admin PW confirmation, correct?
OCP.AppConfig.setValue('announcementcenter', 'admin_groups', groups);


Post must be at least 10 characters.

I started developing an app for SQL authentication and I want to store the quries in the file for now. I am used to linux and it just seems more convenient to edit a file during initial setup of Nextcloud than have to run occ several times. The only advante I see in the UI is that users would be able to test the queries from inside the app configuration dialog.

@Rello: admin pw configuration would not be a problem to me since the app is core administration