allow gitolite_rc.mkd values to be overridden by ~/.gitolite.rc

you might wonder why these are different from all the other variables in
the rc file... it's just that I never thought people would want to
change these!
This commit is contained in:
Sitaram Chamarty 2011-02-14 22:20:38 +05:30
parent b97115f85b
commit dfdab0f3c8
2 changed files with 33 additions and 15 deletions

View file

@ -16,6 +16,7 @@ In this document:
* <a href="#_variables_with_a_security_impact">variables with a security impact</a> * <a href="#_variables_with_a_security_impact">variables with a security impact</a>
* <a href="#_less_used_changed_variables">less used/changed variables</a> * <a href="#_less_used_changed_variables">less used/changed variables</a>
* <a href="#_rarely_changed_variables">rarely changed variables</a> * <a href="#_rarely_changed_variables">rarely changed variables</a>
* <a href="#_constants_that_aren_t_">constants that aren't!</a>
[Note: in perl, there is no actual boolean. The undefined value, the number [Note: in perl, there is no actual boolean. The undefined value, the number
'0', and the empty string, are all 'false'. Everything else is 'true'. It is '0', and the empty string, are all 'false'. Everything else is 'true'. It is
@ -340,6 +341,23 @@ on feedback from my users to find or fix issues.
install has completed is doable: just [disable writes][dwr] to gitolite, install has completed is doable: just [disable writes][dwr] to gitolite,
move `~/repositories/*`, change this variable, then re-enable writes. move `~/repositories/*`, change this variable, then re-enable writes.
<a name="_constants_that_aren_t_"></a>
### constants that aren't!
The source file `src/gitolite_rc.pm` defines a few "constants", for example:
$R_COMMANDS=qr/^(git[ -]upload-pack|git[ -]upload-archive)$/;
Let's say you want to disallow the archive feature, you would need to change
this constant.
As of this version, you can now change these "constants" also, simply by
defining a new value for any or all of them in your `~/.gitolite.rc` file.
If you use this to relax some of the patterns involved (for example, the value
of `ADC_CMD_ARGS_PATT`), please be sure you know what you're doing.
[wild]: http://sitaramc.github.com/gitolite/doc/wildcard-repositories.html [wild]: http://sitaramc.github.com/gitolite/doc/wildcard-repositories.html
[bc]: http://sitaramc.github.com/gitolite/doc/big-config.html [bc]: http://sitaramc.github.com/gitolite/doc/big-config.html
[faq]: http://sitaramc.github.com/gitolite/doc/3-faq-tips-etc.html [faq]: http://sitaramc.github.com/gitolite/doc/3-faq-tips-etc.html

View file

@ -26,21 +26,6 @@ use Exporter 'import';
$GL_HTTP_ANON_USER $GL_HTTP_ANON_USER
); );
# ------------------------------------------------------------------------------
# bring in the rc vars and allow querying them
# ------------------------------------------------------------------------------
# in case we're running under Apache using smart http
$ENV{HOME} = $ENV{GITOLITE_HTTP_HOME} if $ENV{GITOLITE_HTTP_HOME};
# we also need to "bring in" the rc variables. The rc can only be in one of
# these two places; the first one we find, wins
for ("$ENV{HOME}/.gitolite.rc", "/etc/gitolite/gitolite.rc") {
$ENV{GL_RC} ||= $_ if -f;
}
die "no rc file found\n" unless $ENV{GL_RC};
do $ENV{GL_RC} or die "error parsing $ENV{GL_RC}\n";
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# real constants # real constants
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -65,6 +50,21 @@ $REPOPATT_PATT=qr(^\@?[0-9a-zA-Z[][\\^.$|()[\]*+?{}0-9a-zA-Z._\@/-]*$);
# ADC commands and arguments must match this pattern # ADC commands and arguments must match this pattern
$ADC_CMD_ARGS_PATT=qr(^[0-9a-zA-Z._\@/+:-]*$); $ADC_CMD_ARGS_PATT=qr(^[0-9a-zA-Z._\@/+:-]*$);
# ------------------------------------------------------------------------------
# bring in the rc vars and allow querying them
# ------------------------------------------------------------------------------
# in case we're running under Apache using smart http
$ENV{HOME} = $ENV{GITOLITE_HTTP_HOME} if $ENV{GITOLITE_HTTP_HOME};
# we also need to "bring in" the rc variables. The rc can only be in one of
# these two places; the first one we find, wins
for ("$ENV{HOME}/.gitolite.rc", "/etc/gitolite/gitolite.rc") {
$ENV{GL_RC} ||= $_ if -f;
}
die "no rc file found\n" unless $ENV{GL_RC};
do $ENV{GL_RC} or die "error parsing $ENV{GL_RC}\n";
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# per perl rules, this should be the last line in such a file: # per perl rules, this should be the last line in such a file:
1; 1;