[Openais] [PATCH] Use objdb

Steven Dake sdake at redhat.com
Wed Apr 12 19:22:01 PDT 2006


On Tue, 2006-04-11 at 10:21 +0200, Hans Feldt wrote:
> Patrick Caulfield wrote:
> > Steven Dake wrote:
> > 
> >>On Mon, 2006-04-10 at 20:37 +0100, Patrick Caulfield wrote:
> > 
> > 
> >>>How about making aisparser read its config filename from an environment 
> >>>variable ?
> >>>
> >>
> >>yes this was the suggestion, although if no config environment variable
> >>is present the defaults will be used.
> > 
> > 
> > That's pretty easy :)
> 
> But from what I understand, you don't want the command line parser in 
> main.c to set this env variable? You want it to be set externally to 
> aisexec?
> 
> I have played around with the following command line options:
> 
> > +       fprintf(stderr, "\nUsage: aisexec [options]\n\n"
> > +                       "Valid options:\n"
> > +                       "  -h\tthis help\n"
> > +                       "  -F\tForeground, do not daemonize (useful for debugging)\n"
> > +                       "  -d\tEnable debug mode, produces a lot of debug output\n"
> > +                       "  -c <config file>\n  \tconfiguration file, default %s\n",
> > +                       config_file);
> 
> How about a more generic OPENAIS_CONFIG_FILE env variable set by the 
> command line parser? It could be used by any config parser!
> 
> I really want the -c option on the command line and its kind of standard 
> for all daemons to have this. See e.g. syslog-ng, xinetd, mountd, ... 
> although it is named different things.
> 
Hans,
Given the generic nature by which services may be loaded I'd prefer that
any configuration options occur via the environment or via the
configuration object database configured by the default or non-default
ais parser.  This simplifies passing around specific configuration
options to the various dynamically loadable services.

I do like the idea of the -F and -d options as command line options
since they have no internal impact on loadable services (the detach from
tty and debug mode operations won't ever be a lcrso, or atleast aren't
today:)

> Regards,
> Hans
> 
> 
> 
> > 
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > Index: aisparser.c
> > ===================================================================
> > --- aisparser.c	(revision 978)
> > +++ aisparser.c	(working copy)
> > @@ -183,10 +183,15 @@
> >  	char **error_string)
> >  {
> >  	FILE *fp;
> > +	char *filename;
> >  	char *error_reason = error_string_response;
> >  	int res;
> >  
> > -	fp = fopen (OPENAIS_CONFDIR "/openais.conf", "r");
> > +	filename = getenv("OPENAIS_AISPARSER_FILENAME");
> > +	if (!filename)
> > +		filename = OPENAIS_CONFDIR "/openais.conf";
> > +
> > +	fp = fopen (filename, "r");
> >  	if (fp == 0) {
> >  		sprintf (error_reason, "Can't read file %s/openais.conf reason = (%s)\n",
> >  			 OPENAIS_CONFDIR, strerror (errno));
> 




More information about the Openais mailing list