Should you store configuration in database?

Should you store configuration in database?

It really depends on your application. Storing the settings in the database has several advantages: Security – users can easily alter settings in the file or overwrite the contents. For Distribution – the same settings can be updated and loaded onto any machines on the network.

How are tables stored in SQLite?

tl;dr: Each SQLite database is a set of files, one for the database, and others for things like transactions. In the database file, each table is a B-tree with one row per node. A node’s key is the rowid and the value is the types and sizes of each column, plus the value of each column for that row.

What is the file extension for SQLite database?

SQLite

Filename extension .sqlite3, .sqlite, .db
Internet media type application/vnd.sqlite3
Magic number 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 (zero-terminated ASCII “SQLite format 3”)
Initial release 2004-06-18
Open format? yes (Public Domain)

How can I edit settings in SQLite database?

Settings from the DB can be edited via a GUI that is part of the application and directly updated using the already existing DB routines without needing to access some external file. Changes made by the GUI can easily be used to raise events and the new values can be used immediately.

When to read a config file in SQLite?

Config files are typically read only on startup, changes mean restarting the application. (Not a hard rule, but intended use.) Settings from the DB can be edited via a GUI that is part of the application and directly updated using the already existing DB routines without needing to access some external file.

When do you need to store settings in a database?

If you need to store your settings somewhere safe (e.g. saving credentials), then a database would be a slightly better option. Of course you should encrypt those credentials when you either save them on a file or in a table.

Is it OK to store settings in a table?

Your “concerns” will be separated by not defining a relationship between the settings table and other tables in your database. This is fine. The main thing to consider is how you expect the administrator of your system to make changes to the settings. It’s much easier for most people to just open a configuration file and make changes.