News for hackers. Stuff that matters.
Re:Make hard coding your default choice by drig on Monday June 08, 2015 @10:27AM (#9679257)
I always use an in-between system. My configuration library allows me to set a default, if the parameter is not found in the config file. I always set a reasonable default, and then only override if necessary. This keeps the configuration files small, keeps the default value with the code, but allows you maximum flexibility, just in case.
Re:Make hard coding your default choice by jvoorhis on Monday June 08, 2015 @11:06AM (#9679546)
Another tactic that has worked well for me is to expose a flat namespace of flags and tunable parameters in config while shunning instantiation of complex object graphs. Complex nesting in configuration tends to be too "raw" for users and sysops, and hurts usability.
Re:Make hard coding your default choice by markbernard on Tuesday June 09, 2015 @03:38PM (#9688086)
I do the same. I also keep the configuration centralized so all access goes through one class. I also allow defaults in the config file along with specific values based on what environment you are, such as production or UT, etc...
Re:Make hard coding your default choice by zbuf on Monday June 08, 2015 @05:12PM (#9682464)
I've found this method invaluable where we are centrally supporting the same software in multiple environments and in multiple configurations.
Re:Make hard coding your default choice by zwieback on Monday June 08, 2015 @10:57AM (#9679468)
That's the correct approach, in my opinion.
Re:Make hard coding your default choice by ashmud on Monday June 08, 2015 @11:10AM (#9679569)
We do this. For bigger apps, we usually have a db layer, so local config file -> db config -> default in code.