Hi,

I’m asking for opinions and preferences.

There is no right or wrong.

Scenario:

I have a tool (server component, api only, no gui) that has a config file and no per-user adjustable things. The admin can change things, of course.

Now the tool gets plugins, where to configure them?

  1. All in one config file with plugins having a section for their things,
  2. plugins get their own config file.
  3. the main config points to a storage (database) with config options for everything, a kind of variant of 1.
  4. something else/better

Hoping for a civil discussion ;)

Cheers

Grumpy

  • joranvar
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    I’d try to share the config space as much as possible. Options 1 and 3 make sense then.

    What feels “right” to me, when using NixOS and its module system, is that all config has the same shape, and is therefor easily moved to a different section, or to a section that is shared by a subset of plugins.

    Con: It could lead to bad practices like strengthening dependencies between plugins (if they hard code to use a specific config option of another plugin).

    Pro: But if you can discourage that, or use “deprecated pointers” to the new location of an option, the ease of moving shared config options to a more generic level can make it easier to maintain the total configuration. Developers of the separate plugins can build on what others have already done, and even synergize functionality (add a convenient integration if they see another option configured).

    If some options are “secret”, though, and you don’t want those shared, they should either be in their own config (easier), or you’d need some access control on the configuration storage/file for each plugin (more work). Allowing a plugin to have a separate file for credentials, for instance, could be a good choice.

    • joranvar
      link
      fedilink
      arrow-up
      5
      ·
      1 month ago

      As Flatfire mentions, another issue can arise if plugins can modify the config. I assumed config to be read-only for the software, only editable by the admins, and never by the tools themselves.