3 ms·
Why use a static configuration file? Why not use a real programming language as the "configuration file"? That way, you can install callbacks, etcetera.
by amelius 10y ago
Why use a static configuration file?
Why not use a real programming language as the "configuration file"? That way, you can install callbacks, etcetera.
- hamandcheese 10y ago1) With great power comes great responsibility. 2) Language decision for the application becomes even more consequential to end users.
- jandrese 10y agoI've seen several programs where the configuration is just a TCL file or something. It has been a bad idea in every case I have seen thus far. My favorite configuration file type? # Comment key = value Trying to do more in the configuration file ends up causing more headaches than it solves. Commenting each option means you don't have to flip through the manual to figure out how to get the stupid thing to run. There is some argument for the: [section] # Comment key = value Style syntax, but I find that for the vast majority of cases making those namespaces is an unnecessary complication. If you have multiple copies of the same option (like multiple VPN endpoints for example), it's almost always a better idea to just split each one up into its own file in a subdirectory instead of trying to stuff all of the info into a single configuration file. People who want to automate stuff later will thank you. There are libraries to read and write those formats just as easily as JSON or XML or anything else. In fact they're usually easier to use because they don't have to worry about hierarchies or namespaces or any of that nonsense. Some more thoughts on the subject: http://stackoverflow.com/questions/648246/at-what-point-does-a-config-file-become-a-programming-language/ http://stackoverflow.com/questions/648246/at-what-point-does...
- amelius 10y agoIn nodejs you can configure a webserver with a require statement and a couple of function calls. Very flexible.