summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-10-07 00:11:25 +0200
committerGitHub <noreply@github.com>2017-10-07 00:11:25 +0200
commitbbfe30297f0a56d4d384f60e0ff20e7c67e08d7a (patch)
treeb2f34eca75df83ecc1f8da1f5d59184bcad242b0 /scripts
parent6fe0afaa39271bbd75cf068abd67b19fd062a843 (diff)
downloadbugzilla-bbfe30297f0a56d4d384f60e0ff20e7c67e08d7a.tar.gz
bugzilla-bbfe30297f0a56d4d384f60e0ff20e7c67e08d7a.tar.xz
Bug 1404092 - Bugzilla->localconfig should directly use environmental variables and ignore the localconfig file
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/entrypoint.pl65
1 files changed, 2 insertions, 63 deletions
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