[ic] perl in interchange.cfg or catalog.cfg?

bill@worldwideimpact.com bill@worldwideimpact.com
Fri, 4 May 2001 14:03:39 -0400


Check out 
http://www.modperl.com/book/chapters/ch8.html#Configuring_Apache_with_Perl 
That is how I am configuring Apache. I am using exim for MTA which 
provides a means to do sql in it's configuration files. I want to keep all 
of my configuration in the mysql database for apache,exim,bind and ic. I 
am building a ui to the database using ic. I will have a central web based 
control center for all of my virtual domains and the services provided for 
each. 

I made a hack to Vend/Config.pm around line 1031 link this:

                if (-f $configfile) {
                  if ($configfile =~ /\.pl$/) {
                        open(GLOBAL, "$configfile 2>/dev/null |");
                  } else {
                        open(GLOBAL, "< $configfile");
                  }
                } 
                unless (-f GLOBAL || -p GLOBAL) 

basically if I #include a file in interchange.cfg that ends in .pl run the 
command on the system and catch STDOUT. This works but I'd prefer a way 
that doesn't involve a change to the code. I just couldn't find out how.

Bill Carr
Worldwide Impact
bill@worldwideimpact.com
413.253.6700




Dan B <db@cyclonehq.dnsalias.net>
Sent by: interchange-users-admin@lists.akopia.com
05/04/2001 12:53 PM
Please respond to interchange-users

 
        To:     interchange-users@lists.akopia.com
        cc: 
        Subject:        Re: [ic] perl in interchange.cfg or catalog.cfg?


At 09:38 AM 5/4/2001 -0700, you wrote:
>At 11:28 AM 05/04/2001 -0400, you wrote:
>>Is there an easy way to embed perl in the interchange.cfg or catalog.cfg
>>files similar to <perl> sections in httpd.conf (apache/mod_perl)? I am
>>trying to link my interchange configuration with my mysql database. I
>>found a way but it involved making changes to Vend/Config.pm. I am using
>>4.7.1.
>>
>>Bill Carr
>>Worldwide Impact
>>bill@worldwideimpact.com
>>413.253.6700
>
>Hmmm...take a look at the docs on User defined tags, and also the 
>Globalsub directive for interchange.cfg (Config docs).
>
>You've lost me (and no doubt others) with 'link my interchange 
>configuration with my mysql database' - Interchange supports mySQL for 
>databases via the Perl DBI - did you read the docs for 'Interchange 
Database'?

I think what Bill is trying to do sounds interesting, e.g.:
(psuedocode)
Catalog.cfg:
[perl]
         if (date() == Tuesday){
                 query_msyql("SELECT catalog_cfg FROM 
catalogs_config_files 
WHERE use_date="tuesday");
         }
         return results;
[/perl]

Which would allow you to use a given set of configuration depending on 
arbitrary perl code (such as database contents via the day of the week).

There's probably a way to do this already, but I don't know it.

Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com


_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users