# GNUmed configuration files

GNUmed uses the standard INI style configuration file format. The extension .conf is used for all config files.

Lists (options spanning several lines) are defined slightly differently from some other INI file parsers. They work very similar to PostgreSQL dollar quoting in stored procedures. Assume we want to define a list users in a group preferences. This would be the relevant section in the config file:

    [preferences]
    users = $users$
    McCoy
    Spock
    Kirk
    $users$

In reality, a preference "users" is not deployed in the GNUmed config files. A better real example would be the [backend] profiles that assist choosing from among optionally more than one database (public server, local database) to which to connect.

Examples of what is possible to specify as core client configurations are being maintained in the file gm-from-vcs.conf

In most cases, the core .config file(s) are edited directly, and then recopied where appropriate among local directories and machines whether by IT support, local administrators or advanced users. Values manageable through the GNUmed Preferences submenu are, in a few cases (such as sender email), written back into the config file so as to be available to the exception handler even before a database connection would have been made. Preferences are otherwise stored in the back end database.

## Default configuration files

GNUmed uses a few built-in configuration file names. Most of them can be overriden by the command line option

    --conf-file=FILE

where `FILE` is the name of the configuration file you want to use instead. Make sure this file is writable by the user as it will be used to store default settings.

GNUmed will try to work around missing configuration files by providing sensible defaults without exhibiting surprising behaviour.

### `/etc/gnumed/gnumed-client.conf`

This file can be used to define system-wide defaults such as backend profiles. Those profiles will be available through the login dialog in addition to those defined elsewhere. The file will be opened read-only.

On non-Unix systems this file will be stored in other directories. Please refer to the wxPython documentation to find out where.

### `~/.gnumed/gnumed.conf`

Additional defaults can be stored in this file. Any backend profiles will be added to the list of profiles available from `/etc/gnumed/gnumed-client.conf`. This file is also used to store user preferences which need to be available before a connection to the database has been made. Therefore the user needs write access to it.

Configuration information about the workplace, slave mode and external patient sources is also found here.

### `./gnumed.conf`

If no `~/.gnumed/gnumed.conf` file is found GNUmed will scan the current directory (from which it was invoked) for a file `gnumed.conf`. This allows starting GNUmed from an arbitrary directory (such as a copy of the VCS tree) without needing a `gnumed.conf` installed in `~/.gnumed/`.

### `~/.gnumed/gnumed-xsanerc.conf`

Used since: GNUmed v0.2.9

Requires: XSane > v0.992

When GNUmed invokes XSane for scanning it passes along this file (via `--xsane-rc`). This way a custom XSane configuration can be used with GNUmed. If the file doesn't exist it will be created from `~/.sane/xsane/xsanerc` on the first call to XSane.

When you configure XSane after calling it from GNUmed your changes will be stored in the GNUmed-specific XSane configuration file and will thus not affect your usual XSane settings.

### `mime_type2file_extension.conf`

This file is used by GNUmed to assist in finding a suitable filename extension for certain mime types such as when displaying archived documents. It is only needed if the Operating System cannot figure out by itself how to display files of a certain type without the filename having an extension. This has mainly been observed on MS/Windows, particularly with bitmap type files.

GNUmed searches for this file in the system-wide (that is `/etc/gnumed/` on UNIX) and user-level (say, on UNIX, `~/.gnumed/`) configuration directories. If you cannot figure out what your Operating System thinks those directories should be check the GNUmed log file. It tells you where GNUmed looks for the file on your machine.

The file must contain a group [extensions] under which there can be one option per mime type specifying the extension to use on files of said type. Set the value to the raw extension only, omitting the ".", like so:

    [extensions]
    # set extension for bitmap files (mime type <image/x-bmp>) to "bmp"
    # (IOW, they should read "<filename>.bmp" when passed to the OS for viewing)
    image/x-bmp = bmp

Listings available here:

- MIME Types (Global) San Francisco State University
- MIME Types By Content Type supported by Microsoft Internet Information Server version 5
- MIME Types by File type extension
- MIME Types by Description of Data Content University of Toronto