Re: [PATCHv3 2/2 (version B)] gitweb: Use /etc/gitweb.conf even if gitweb_conf.perl exist
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 25, 2011, 18:54 UTC
- Message-ID
- <7v8vtu4nmy.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1306341328-11108-4-git-send-email-jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
Show 5 quoted lines
> This commit should be thought as exclusive to > > [PATCH 2/2 (version A)] gitweb: Mention read_config_file in gitweb/README > > We have to choose one or the other.
Who says? We do not have to. Why not do this instead?
our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} ||
"/etc/gitweb-common.conf"; # common system-wide settings for convenience
read_config_file($GITWEB_COMMON); # as always, use the per-instance GITWEB_CONFIG if exists,
# otherwise use GITWEB_SYSTEM_CONFIG
read_config_file($GITWEB_CONFIG) ||
read_config_file($GITWEB_CONFIG_SYSTEM);There is no risk of hurting any existing installations, and people who do have things that needs to be shared do not have to go around and update all the per-instance configuration files.
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
Show 16 quoted lines
> index ce92d67..e4b0932 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -656,9 +656,10 @@ sub evaluate_gitweb_config {
> our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++";
> our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
>
> - # use first config file that exists
> - read_config_file($GITWEB_CONFIG) or
> + # let settings in second override ones in first
> read_config_file($GITWEB_CONFIG_SYSTEM);
> + read_config_file($GITWEB_CONFIG)
> + if ($GITWEB_CONFIG ne $GITWEB_CONFIG_SYSTEM);
> }
>
> # Get loadavg of system, to compare against $maxload.