From bbfe30297f0a56d4d384f60e0ff20e7c67e08d7a Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Fri, 6 Oct 2017 18:11:25 -0400 Subject: Bug 1404092 - Bugzilla->localconfig should directly use environmental variables and ignore the localconfig file --- scripts/entrypoint.pl | 65 ++------------------------------------------------- 1 file changed, 2 insertions(+), 63 deletions(-) (limited to 'scripts') diff --git a/scripts/entrypoint.pl b/scripts/entrypoint.pl index faec25719..40e7cd577 100755 --- a/scripts/entrypoint.pl +++ b/scripts/entrypoint.pl @@ -31,7 +31,6 @@ my $opts = __PACKAGE__->can("opt_$cmd") // sub { @ARGV }; fix_path(); check_user(); check_env() unless $cmd eq 'shell'; -write_localconfig( localconfig_from_env() ); $func->(@ARGV); @@ -218,7 +217,7 @@ sub wait_for_httpd { } elsif ( $process->is_exited ) { $timer->stop; - $is_running_f->fail("process exited early"); + $is_running_f->fail("httpd process exited early"); } elsif ( $ticks++ > 60 ) { $timer->stop; @@ -284,67 +283,6 @@ sub on_finish { }; } -sub localconfig_from_env { - my %localconfig = ( webservergroup => 'app' ); - - my %override = ( - 'inbound_proxies' => 1, - 'shadowdb' => 1, - 'shadowdbhost' => 1, - 'shadowdbport' => 1, - 'shadowdbsock' => 1 - ); - - foreach my $key ( keys %ENV ) { - if ( $key =~ /^BMO_(.+)$/ ) { - my $name = $1; - if ( $override{$name} ) { - $localconfig{param_override}{$name} = delete $ENV{$key}; - } - else { - $localconfig{$name} = delete $ENV{$key}; - } - } - } - - return \%localconfig; -} - -sub write_localconfig { - my ($localconfig) = @_; - no warnings 'once'; - - my $filename = "/app/localconfig"; - - die "/app/localconfig already exists!" if -f $filename; - - foreach my $var (Bugzilla::Install::Localconfig::LOCALCONFIG_VARS) { - my $name = $var->{name}; - my $value = $localconfig->{$name}; - if (!defined $value) { - $var->{default} = &{$var->{default}} if ref($var->{default}) eq 'CODE'; - $localconfig->{$name} = $var->{default}; - } - } - - # Ensure output is sorted and deterministic - local $Data::Dumper::Sortkeys = 1; - - # Re-write localconfig - open my $fh, ">:utf8", $filename or die "$filename: $!"; - foreach my $var (Bugzilla::Install::Localconfig::LOCALCONFIG_VARS) { - my $name = $var->{name}; - my $desc = install_string("localconfig_$name", { root => Bugzilla::Install::Localconfig::ROOT_USER }); - chomp($desc); - # Make the description into a comment. - $desc =~ s/^/# /mg; - print $fh $desc, "\n", - Data::Dumper->Dump([$localconfig->{$name}], - ["*$name"]), "\n"; - } - close $fh; -} - sub check_user { die "Effective UID must be 10001!" unless $EUID == 10001; my $user = getpwuid($EUID)->name; @@ -358,6 +296,7 @@ sub check_data_dir { sub check_env { my @require_env = qw( + LOCALCONFIG_ENV BMO_db_host BMO_db_name BMO_db_user -- cgit v1.2.3-24-g4f1b