I have a general question that isn’t fully related to Go I suppose, but my program is written in Go so i’ll ask here!
I have an application that can be configured using a combination of config files/env vars/flags, the application also maintains state in a database (sqlite/postgres/msql).
For low level config things I accept them as options in the config file/env/flag path, things like this include port to listen on (webserver), log file location, log level, db host/user/pass and so on.
I now have added the ability for the application to send emails via SMTP – however this is not required to use the application, it’s more of a feature that you can use if you like.
With all of the above in mind I now have two options, I can accept the SMTP configuration as part of the normal config path or I can accept that config via the web frontend + store it in the database. My general question is how do you decide what should be a run time configuration vs what should be a user configuration that is persisted in the database? In the wild I have seen it done both ways, but curious on why you select a certain way. My gut tells me that mandatory configurations that the application needs to start up and actually run should be configured in the file/env/flag path while configuration of ‘features’ should be done inside the application itself.