]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
no bug - make start_morbo smarter
authorDylan William Hardison <dylan@hardison.net>
Fri, 1 Feb 2019 22:26:50 +0000 (17:26 -0500)
committerDylan William Hardison <dylan@hardison.net>
Fri, 1 Feb 2019 22:41:09 +0000 (17:41 -0500)
scripts/start_morbo [new file with mode: 0755]
vagrant_support/devtools.yml
vagrant_support/playbook.yml
vagrant_support/start_morbo [deleted file]

diff --git a/scripts/start_morbo b/scripts/start_morbo
new file mode 100755 (executable)
index 0000000..805b82c
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/env perl
+
+use File::Basename qw(basename dirname);
+use File::Spec::Functions qw(catfile catdir);
+use Cwd qw(realpath);
+our $BUGZILLA_DIR;
+
+BEGIN {
+  require lib;
+  $BUGZILLA_DIR = dirname(dirname(realpath(__FILE__)));
+  lib->import(
+    $BUGZILLA_DIR,
+    catdir($BUGZILLA_DIR, 'lib'),
+    catdir($BUGZILLA_DIR, qw(local lib perl5))
+  );
+}
+use Env qw(@PATH @PERL5LIB $MOJO_LISTEN $BUGZILLA_ALLOW_INSECURE_HTTP MOJO_REVERSE_PROXY);
+
+chdir $BUGZILLA_DIR;
+
+my $cert_file = catfile($BUGZILLA_DIR, 'bmo-web.vm.pem');
+my $key_file  = catfile($BUGZILLA_DIR, 'bmo-web.vm-key.pem');
+
+if ($MOJO_LISTEN && -f $cert_file && -f $key_file) {
+  $MOJO_LISTEN .= ",https://*:443?cert=$cert_file&key=$key_file";
+}
+
+push @PERL5LIB, catdir($BUGZILLA_DIR, qw(local lib perl5));
+unshift @PATH,  catdir($BUGZILLA_DIR, qw(local bin));
+$BUGZILLA_ALLOW_INSECURE_HTTP //= 1;
+$MOJO_REVERSE_PROXY //= $BUGZILLA_DIR ne '/vagrant';
+
+my @files
+  = ('Bugzilla.pm', 'Bugzilla', glob("*.cgi"), 'extensions', 'template');
+my @watch = map { ('-w' => $_) } (@files);
+
+exec morbo => @watch, '-v', 'bugzilla.pl';
index e44a00dd7f5414eb7d927c28ab6cb86dbb004828..0034c9371d7e2d0d848a5da875cae687b5b38a5a 100644 (file)
@@ -19,7 +19,7 @@
   copy: src=re.pl dest=/usr/local/bin/re.pl mode=0755
 
 - name: copy start_morbo
-  copy: src=start_morbo dest=/usr/local/bin/start_morbo mode=0755
+  file: path=/usr/local/bin/start_morbo src=/vagrant/scripts/start_morbo state=link force=true
 
 - name: copy use-nytprof
   copy: src=use-nytprof dest=/usr/local/bin/use-nytprof mode=0755
index 3dd320f0b67be783249785300dab0ef6e9e76b69..cb97512f013994b59fa44251b75f3cfd6d427315 100644 (file)
         group: root
         mode: 0644
 
+    - name: 'add MOJO_LISTEN'
+      lineinfile:
+        dest: /etc/environment
+        regexp: 'MOJO_LISTEN='
+        line: 'MOJO_LISTEN=http://*::80'
+        owner: root
+        group: root
+        mode: 0644
+
     - name: copy ntp.conf
       copy:
         src: ntp.conf
diff --git a/vagrant_support/start_morbo b/vagrant_support/start_morbo
deleted file mode 100644 (file)
index cb06584..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env perl
-
-my $cert_file = '/vagrant/bmo-web.vm.pem';
-my $key_file  = '/vagrant/bmo-web.vm-key.pem';
-my $listen    = 'http://*:80';
-
-if (-f $cert_file && -f $key_file) {
-  $listen .= ",https://*:443?cert=$cert_file&key=$key_file";
-}
-
-$ENV{PERL5LIB}    = '/vagrant/local/lib/perl5';
-$ENV{PATH}        = "/vagrant/local/bin:$ENV{PATH}";
-$ENV{MOJO_LISTEN} = $listen;
-$ENV{BUGZILLA_ALLOW_INSECURE_HTTP} = 1;
-
-my @files
-  = ('Bugzilla.pm', 'Bugzilla', glob("*.cgi"), 'extensions', 'template');
-my @watch = map { ('-w' => $_) } (@files);
-
-system morbo => @watch, '-v', 'bugzilla.pl';