Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 474
Carl Bergquist Avatar asked Nov 28 '22 05:11

Carl Bergquist


2 Answers

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.

like image 147
pjp Avatar answered Dec 05 '22 13:12

pjp


In linux, there is a command "at" for batch execution.
See "man at" for details.

like image 34
sud03r Avatar answered Dec 05 '22 12:12

sud03r