You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2016/03/06 20:24:10 UTC

[whimsy.git] [1/2] Commit a0b045f: enable tailoring of HTTPS setting

Commit a0b045f44ff2b5d3ba78ea8332a420125cc01cc4:
    enable tailoring of HTTPS setting


Branch: refs/heads/master
Author: Sam Ruby <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@apache.org>

------------------------------------------------------------
www/test/vhost-generator.cgi                                 | +++++++ -
------------------------------------------------------------
16 changes: 14 additions, 2 deletions.
------------------------------------------------------------


diff --git a/www/test/vhost-generator.cgi b/www/test/vhost-generator.cgi
index 73f6669..d054124 100755
--- a/www/test/vhost-generator.cgi
+++ b/www/test/vhost-generator.cgi
@@ -3,12 +3,13 @@
 require 'wunderbar'
 
 # response to form requests
-if ENV['REQUEST_METHOD'].upcase == 'POST'
+if ENV['REQUEST_METHOD'].to_s.upcase == 'POST'
   cgi = CGI.new
   cgi.out 'type' => 'text/plain' do
     # extract parameters
     hostname = cgi.params['hostname'].first
     docroot = cgi.params['docroot'].first
+    https = cgi.params['https'].first
 
     # read live configuration
     conf = File.read(Dir['/etc/apache2/sites-available/*whimsy*.conf'].first)
@@ -30,6 +31,9 @@ if ENV['REQUEST_METHOD'].upcase == 'POST'
     # global replace docroot
     conf.gsub! '/srv/whimsy', docroot.chomp('/')
 
+    # global replace docroot
+    conf.gsub! /SetEnv HTTPS .*/, "SetEnv HTTPS #{https}"
+
     conf
   end
 
@@ -70,10 +74,18 @@ _html do
           value: '/srv/whimsy'
       end
 
+      _div_ do
+        _label 'HTTPS', for: 'https'
+        _select id: 'https', name: 'https' do
+          _option 'on'
+          _option 'off', selected: true
+        end
+      end
+
       _input type: 'submit', value: 'Submit'
     end
 
-    _h3 'Modules required'
+    _h3 'Modules enabled'
     _ul do
       Dir['/etc/apache2/mods-enabled/*.load'].sort.each do |conf|
         _li File.basename(conf, '.load')