3.5. Gnumed Configuration

Gnumed uses two sources of configuration information: - INI-style configuration files - database tables After importing gmCfg.py data stored in a standard configuration file at ~/.gnumed/gnumed.conf is available. Information in this file is particularly important for all activity until a connection to the backend has been established. Once the backend available, configuration information stored in tables of the gnumed database can be used. However, it is possible to force file or database access at any time.

3.5.1. Standard configuration file

Currently the default configuration file holds the following information:
# GnuMed client config file                                                     
                                                                                
[backend]                                                                       
databases = $databases$                                                         
gnumed                                                                          
$databases$                                                                     
ports = $ports$                                                                 
5432                                                                            
$ports$                                                                         
hosts = $hosts$                                                                 
localhost                                                                       
127.0.0.1                                                                       
$hosts$                                                                         
options = $options$                                                             
                                                                                
$options$                                                                       
logins = $logins$                                                               
hinnef                                                                          
guest                                                                           
$logins$                                                                        

[workplace]                                                                     
# this is to identify the machine at a logical (business) level                 
name = test                           
	

3.5.2. Database configuration tables

Table 'db' holds the information on databases known to gnumed. The database that has id=0 is always the default database, that is the database used to log in to the backend at the start of gnumed (=the one the configuration tables are stored on). If no entry for id=0 is present, the parameters passed on startup are used. Additional databases like demographic databases, drug databases must therefore use id's >= 1.

CREATE TABLE db (
id SERIAL PRIMARY KEY,
name CHAR(35),	    	-- name of the database
port INT DEFAULT 5432,  -- port number of server hosting this database
host VARCHAR(255)DEFAULT 'localhost', -- host name of IP number of the server hosting the database
opt varchar(255) DEFAULT '',	-- options passed to the database backend
tty varchar(255) DEFAULT ''
);
	

Table 'ddb' holds the names assigned to services known to gnumed. Names and actual databases are linked via the table 'config'

CREATE TABLE distributed_db (
	id SERIAL PRIMARY KEY,
	name char(35)
);
    	

The following services are predefined. Naming of additional services needs approval by gnumed administrators!

Table 'config' holds general information about available databases, services and users.

    CREATE TABLE config (
    id SERIAL PRIMARY KEY,
    profile CHAR(25) DEFAULT 'default',     	    -- allows multiple profiles per user / pseudo user
    	    	    	    	    	    	    -- one user may have different configuration profiles depending on role, need and location
    username CHAR(25) DEFAULT CURRENT_USER, 	    -- user name as used within the gnumed system
    ddb INT REFERENCES distributed_db DEFAULT NULL, -- reference to one of the allowed distrbuted servers
    db INT REFERENCES db,   	    	    	    -- reference to the implementation details of the distributed server
    crypt_pwd varchar(255) DEFAULT NULL,    	    -- password for user and database, encrypted
    crypt_algo varchar(255) DEFAULT NULL,   	    -- encryption algorithm used for password encryption
    pwd_hash varchar(255) DEFAULT NULL,     	    -- hash of the unencrypted password
    hash_algo varchar(255) DEFAULT NULL     	    -- algorithm used for password hashing
);
    	

3.5.3. Setting up a service

  1. Store the parameters to access the database in table 'db':

    insert into db VALUES (<db_id>,'database_name', <port> , <host> , <opt> , <tty>);

    where <db_id> is not 0 (0 is already assigned to the default database). The parameters <port> , <host> , <opt> and <tty> can be omitted if the backend is the same as for the default database.

  2. Link database to service in table 'config':

    insert into config VALUES ('','','username', <distributed_db_id> , <db_id>) ;

    where <distributed_db_id> and < db_id > reference entries in tables 'db' and 'ddb'. If you add a new service, you will have to update table 'ddb' before. Please contact the gnumed admins before adding new services !