Skip to content

Commit

Permalink
Convert script/configure-web-proxy from POSIX sh to bash
Browse files Browse the repository at this point in the history
  • Loading branch information
asdil12 committed Jul 6, 2023
1 parent 8224eee commit 4df1cd6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions script/configure-web-proxy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh -e
#!/bin/bash -e

usage() {
cat << EOF
Expand All @@ -18,7 +18,7 @@ eval set -- "$opts"
web_proxy="apache"
while true; do
case "$1" in
-h | --help ) usage 0; shift ;;
-h | --help ) usage 0 ;;
-p | --proxy ) web_proxy=${2#*=}; shift ;;
-- ) shift; break ;;
* ) break ;;
Expand All @@ -27,11 +27,11 @@ done

sed -i -e 's/^.*httpsonly.*$/httpsonly = 0/g' /etc/openqa/openqa.ini

if [ "$web_proxy" = "nginx" ] ; then
if [[ $web_proxy == "nginx" ]] ; then
echo "Setting up nginx"
sed "s/openqa.example.com/$(hostname)/" /etc/nginx/vhosts.d/openqa.conf.template > /etc/nginx/vhosts.d/openqa.conf
sed -i -e "s/\(^[^#]*server_name localhost;\)/#\1/" /etc/nginx/nginx.conf
elif [ "$web_proxy" = "apache" ] || [ "$web_proxy" = "apache2" ] ; then
elif [[ $web_proxy == "apache" ]] || [[ $web_proxy == "apache2" ]] ; then
echo "Setting up apache"
for i in headers proxy proxy_http proxy_wstunnel rewrite ; do a2enmod $i ; done
sed "s/#ServerName.*$/ServerName $(hostname)/" /etc/apache2/vhosts.d/openqa.conf.template > /etc/apache2/vhosts.d/openqa.conf
Expand Down

0 comments on commit 4df1cd6

Please sign in to comment.