It depends just how much config you have, but for small to medium
amounts we've standardized on a single library that provides
"Environment Aware" config. It looks at the MachineName, we're a
large enough org that the machines have a naming convention that our
project has strictly followed, so if it's PWeb it's a prod box, TWeb
is a Test box, and everything else (DWeb and developers boxes) we
treat as Dev.
Our XML looks roughly like this:
<Server NamePattern="PWeb">
<Item>Prod</Item>
</Server>
<Server NamePattern="TWeb">
<Item>Test</Item>
</Server>
So all the client code does is ask the library for the "Correct"
config block, and then accesses the sub elements without ever knowing
which one it's really accessing (though it gets the whole Server chunk
in case it happens to care). This would get very unruly if each
environment had hundreds of lines of XML config... in that case I'd
prob. switch to a version that matches Config file names to the server
naming pattern and then you'd only deploy the PWeb.xml to the Prod
boxes, etc, or picking during the build process (we currently don't
have a centralized or automated build. Either way the code calling it
wouldn't know or care about the differences, it just gets back XML
that it knows how to read (or an Object, etc).
Matt
On Mon, Sep 14, 2009 at 11:06 AM, mcintyre321 <
mcintyre321@...> wrote:
>
> Of course config shouldn't be more than it needs to be, but changing the
> hosts file doesn't really cover something like different API keys for a 3rd
> party service for dev/test/live, or different local disk paths etc.
>
>
> Adam Dymitruk wrote:
>>
>> config differences can be a lot more.. but they shouldn't if they
>> don't have to be
>>
>> How would you have to change the host file every time the config file
>> changes? I haven't had to change the host files for a long time now...
>>
>
> --
> View this message in context:
http://www.nabble.com/Environment-Agnosticism-tp25194634p25437537.html> Sent from the ALT.NET Yahoo Group mailing list archive at Nabble.com.
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>