On Monday 26 January 2004 11:47, D. Dante Lorenso wrote:
> I want to store config file keys and values in my PG database
> in order to 1) be able to INSERT/UPDATE/DELETE configuration settings
> without a flat file and 2) give access to the config settings with
> my web application.
>
> Right now, my java application uses a config file similar to an .INI
> file with the following format:
>
> [section1]
> key1 = value1
> key2 = "Value Two"
> multi word key3 = 12345
> [section2]
> Who has built something similar to what I'm attempting, and what do you
> recommend?
I tend to have something like:
CREATE TABLE config_settings AS (
section varchar(64),
item varchar(64),
type varchar(16),
value text,
PRIMARY KEY (section,item)
);
In general, two levels (section,item) seem enough, but it's trivial to add
another. I cast the value from text => my desired type in the app (or raise
an exception if there is a problem).
Oh - I frequently add a "notes" or "description" column to for instructions on
what value should go in.
--
Richard Huxton
Archonet Ltd