Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Config values in DB or File?

I have some configuration values for an asp.net web app. They will be maintained by a system admin once the system goes live. Should I store these values in the database or in a config file? Is there a best practice for this sort of thing?

like image 276
Aaron Palmer Avatar asked Oct 29 '08 20:10

Aaron Palmer


3 Answers

It's easy and convenient to create a robust interface to edit the values in the database.

It's less easy to create a good one for the config file.

So I would usually you want to store everything which you would like your users/administrators to be able to edit later in the database. Everything which only needs to be touched during serious changes like re-installation etc is better off in the config file.

like image 108
Ilya Kochetov Avatar answered Oct 01 '22 23:10

Ilya Kochetov


I would always recommend database simply because you can build an Admin UI relatively easy and audit all changes with similar ease. Although you can accomplish the same with changes to a file, the database route with some sort of a Admin control area is always preferable. Especially when you want to know who changed what when.

Also in our environment, changing a config file if there was an error, involves the entire change management process approvals/etc., which is pretty painful. So if you take the time to incorporate configuration settings in a database I think it will work out better in the long run. Just my $0.02.

like image 27
Ta01 Avatar answered Oct 01 '22 23:10

Ta01


I prefer a text config file, .ini style or XML style for these two reasons:

1 - You can put comments in the text file.

2 - Text editors have an "undo" command.

like image 35
Corey Trager Avatar answered Oct 01 '22 22:10

Corey Trager