Subject: Re: [RFC/PATCHv3] git-instaweb: Add support for running gitweb via 'plackup'

From: Jakub Narebski <[email-masked]>
Date: Tue, 25 May 2010 02:11:02 +0200

On Sun, 23 May 2010, Ævar Arnfjörð Bjarmason wrote:
> 2010/5/22 Jakub Narebski <[email-masked]>:
> >
> > Webrick, which is in similar situation, uses httpd.conf config file in
> > YAML.  Unfortunately there is no config / serialization reader in Perl
> > core, so if we have to go this route either the config file would have
> > to be in Perl, or gitweb.psgi wrapper would have to include some simple
> > config file parsing.
> 
> You could easily do (pseudocode):
> 
>     unless (eval { require Config::Any; 1 }) {
>     	do $conf_file;
>     } else {
>     	my $parser = Config::Any->new( ... );
>     	$parser->docnf( $conf_file );
>     }
> 
> Then you'd read (eval) a perl config file by default, but remain
> compatible with saner config formats for users prepared to install
> things from the CPAN.

I was thinking more about something like that:

  my @opts = qw(--env deployment);
  while (<>) {
  	chomp;
  	next unless $_;  # skip empty lines
  	next if /^\s*#/; # skip comments
  	if (/^\s*(.*?)\s*=\s*(.*)\s*$/) {
  		push @opts, '--'.lc($1), $2;
  	}
  }

where httpd.conf would look like this:

  port = 1234
  host = 127.0.0.1

Anyway, if such code is to be be added, it would be added in a separate
commit.
-- 
Jakub Narebski
Poland