diff options
author | Johan Sørensen <johan@johansorensen.com> | 2009-09-16 09:45:59 +0200 |
---|---|---|
committer | Johan Sørensen <johan@johansorensen.com> | 2009-09-16 09:45:59 +0200 |
commit | c24ca148965b93ace4041d25186ee135cccbb794 (patch) | |
tree | a9746877ddd795e343f6660ff89c2aae71ac4091 /script/git-daemon | |
parent | 3e412512abf041dd904c94056e42442e5e877375 (diff) | |
download | gitorious-mainline-outdated-c24ca148965b93ace4041d25186ee135cccbb794.zip gitorious-mainline-outdated-c24ca148965b93ace4041d25186ee135cccbb794.tar.gz gitorious-mainline-outdated-c24ca148965b93ace4041d25186ee135cccbb794.tar.bz2 |
Add a cmd-line flag to git-daemon to disable GeoIP based logging
Diffstat (limited to 'script/git-daemon')
-rwxr-xr-x | script/git-daemon | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/script/git-daemon b/script/git-daemon index 1cec16f..bd05fc2 100755 --- a/script/git-daemon +++ b/script/git-daemon @@ -118,14 +118,16 @@ module Git $children_active -= 1 return end - - if ip_family == "AF_INET6" - repository.cloned_from(ip) - else - geoip = GeoIP.new(File.join(RAILS_ROOT, "data", "GeoIP.dat")) - localization = geoip.country(ip) - geoip.close - repository.cloned_from(ip, localization[3], localization[5], 'git') + + unless @options[:disable_geoip] + if ip_family == "AF_INET6" + repository.cloned_from(ip) + else + geoip = GeoIP.new(File.join(RAILS_ROOT, "data", "GeoIP.dat")) + localization = geoip.country(ip) + geoip.close + repository.cloned_from(ip, localization[3], localization[5], 'git') + end end Dir.chdir(real_path) do @@ -265,6 +267,7 @@ options = { :pidfile => File.join(RAILS_ROOT, "log", "git-daemon.pid"), :daemonize => false, :reuseaddr => true, + :disable_geoip => false, } OptionParser.new do |opts| @@ -293,6 +296,10 @@ OptionParser.new do |opts| opts.on("-r", "--reuseaddr", "Re-use addresses", "Default: #{options[:reuseaddr].inspect}") do |o| options[:reuseaddr] = o end + + opts.on("-g", "--disable-geoip", "Disable logging of connections with GeoIP", "Default: #{options[:disable_geoip].inspect}") do |o| + options[:disable_geoip] = o + end opts.on_tail("-h", "--help", "Show this help message.") do puts opts |