|
|
|
|
|
by magiconair
3278 days ago
|
|
I think this is example is too simple and misses the point of a config package. If you have config options being read from several different sources (files, args, env) and need to initialize subsystems which need more than one or two parameters (think server with several timeouts, paths, handlers) then you want to pass this as a struct and you need to manage that struct somewhere. Configuration is also an external contract since you don't want to break installations because you want to rename a variable. Therefore, you have to distinguish between argument parsing and the actual runtime configuration and it makes a lot of sense to have that in a single package since you can then test it properly. Configuration is a complex issue for non-trivial projects. Managing this in one place allows to have one source of truth. |
|