I'm working on an app and I want to include sophisticated config files processing. Here's a list of what I want:
Dizzy yet?
The hard part of all this is the chicken-and-egg of letting the config files decide which config files to process.
For example A.conf,B.conf and C.conf are the normal config files in order. (A.conf overrides B.conf, B.conf overrides C.conf) C.conf adds D.conf, B.conf removes C.conf and adds E.conf. So, in the end, we should get the values from A.conf, B.conf and E.conf. I got confused just writing this example!
My best idea so far is to write a big fat algorithm that starts with the basic list of config files and...
And only then start reading config files for the purpose of gathering the other config values.
Does anyone have any bright ideas of how to handle this?
Thanks!
--Pileofrogs
Update: I never knew the right names for the XY Problem and YAGNI. Groovy!
I think, yeah, you're probably both right in that I'm suffering from both XY and YAGNI.
To speak to the XY issues, I've been working with CPAN::Mini::Inject, but the configuration files and command line handling could be better. Specifically, you have to put some variables in config files and others have to be specified on the command line. The command line is always really long. I thought it would be better if you could (1) specify any variable either on the command line or the config file and (2) if values set in the global config files (/etc/mcpani) could be overridden by values in more specific config files ($HOME/.mcpani/config). Some values tend to be the same no matter what you are doing, others tend to be different from user to user, but the same across that user's projects. Others tend to be different from project to project. I've emailed with the author, and he liked my ideas so I'm working on implementing it now.Now, we get to the YAGNI. What if I decide I don't like what the sysadmin puts in /etc/mcpani? Or, maybe I realise that half my projects use 5 of the same variables, so maybe I want to include a file?
In the reality of the problem, I should probably just say "These are your config files, if you don't like the values, in the global config, override them yourself. If you have the same values come up over and over, deal with it."
However, in the context of monks chewing the fat, this problem seems interesting. I know certain apps do something like this, for example, vim reads /etc/vimrc and $HOME/.vimrc and a zillion other config files as well...
In reply to Config File Shuffle by pileofrogs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |