configurationruntimemodification

Change config values on a specific time


I just got a mail saying that I have to change a config value at 2009-09-01 (new taxes). Our normal approach for this would be to to awake at 2009-08-31 at 23:59 and then just change the value manually. Which not is a big problem since this don't happens to often. But it makes me wonder how other people handle issues like this.

So! How do you handle date specific config changes?

(We are working in asp.net but I don't think this has to be language specific)

Br
Carl Bergquist


Solution

  • I'd normally store this kind of data in a database table like this

    Key,  Value,  EffectiveFrom,  EffectiveTo
    -----------------------------------------
    VAT,    15.0,      20081201,     20091231
    VAT,    17.5,      20100101,         NULL
    

    I'd then use the EffectiveFrom and EffectiveTo dates to chose the value that is effective at the given time. If the rate is open ended then the effecive to could either by NULL or 99991231.

    This also allows you to go back without having to change the config. E.g. if someone asks you to recalculate the tax for the previous month before the rate change.