MidgardConfig comments (Was: [midgard-dev] Automake and directories)

Jukka Zitting <[email protected]> Fri, 17 Feb 2006 20:24:32 +0200
Newsgroups gmane.comp.web.midgard.devel
Message-ID <[email protected]>
Hi,

On 2/17/06, Piotras <[email protected]> wrote:
> OK, so I need your feedback for my roadmap draft of drafts.

I'll do that. :-)

> If you can start to use such config  with 1.8 and midgard-java I will  write API
> proposal for OO midgard connection which will be pre1.9 feature and available
> in 1.8 as wrapper for midgard struct.

Questions about the current config interface:

1) Will the new configuration mechanism be the preferred one already
in 1.8 or only in 1.9 as mentioned in the roadmap?

2) Will midgard_config_read_file() be the correct and only way to get
midgard configuration?

3) Why do I need to pass the full file path to
midgard_config_read_file() when there is a standard directory for the
config files? Is the conf.d directory just a common convention, or is
it absolutely required that all config files be located there?
Couldn't we use something like g_key_file_load_from_data_dirs() to
automatically find the configuration files from the default system
locations?

4) Could we please use the GKeyFile functions to parse the file?
Requiring glib 2.6 or even using a local copy of the glib 2.6 GKeyFile
sources would be a small price for this. This would save us from a yet
another configuration file format, and would make it easy to
programmatically create and modify Midgard configuration files.

5) Currently it seems that the MidgardConfig object is only used by
midgard-apache2 to get the traditional configuration options to be
passed to midgard-core. Will this change, i.e. will there be a funtion
like midgard_connect(MidgardConfig *config)?

6) Are there any ideas on how the configuration mechanism will change
when we switch to libgda? There is a full data source configuration
mechanism in libgda so we could in principle just use a single data
source name to get the database connection.

My idea of a perfect configuration/connection API for Midgard would
look something like this:

    GError *error = NULL;
    MidgardConnection *connection =
midgard_connect("my-midgard-database", &error);

This migdard_connect() function would automatically load the
"my-midgard-database" configuration file from a known location, use
the parsed configuration options to connect to the database and to
initialize all internal data structures, and return possible errors
through the standard GError mechanism. This would hide all the
configuration complexities from the application.

BR,

Jukka Zitting

--
Yukatan - http://yukatan.fi/ - [email protected]
Software craftmanship, JCR consulting, and Java development