Fix template variables

In the httpd module, serveraliases defaults to undef, which evaluates to
nil in ERB templates. Ensure the template checks for nil values so that
the ServerAlias line is only included if there is a server alias.

Also correct the variable usage in the index.html.erb template.

Change-Id: Ibde097b7dd407884336154a318ec4c5661fda03c
This commit is contained in:
Colleen Murphy 2018-05-08 21:36:59 -07:00 committed by Colleen Murphy
parent 3197184609
commit 63153c941e
2 changed files with 3 additions and 3 deletions

View File

@ -4,10 +4,10 @@
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%= name.capitalize %> IRC log server</title>
<title><%= @name.capitalize %> IRC log server</title>
</head>
<body>
<h1>Welcome to <%= name.capitalize %> IRC log server</h1>
<h1>Welcome to <%= @name.capitalize %> IRC log server</h1>
<ul>
<li><a href="/irclogs/">Channel Logs</a></li>
<li><a href="/meetings/">Meeting Logs</a></li>

View File

@ -7,7 +7,7 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
ServerName <%= @srvname %>
<% if @serveraliases.is_a? Array -%>
<% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
<% elsif @serveraliases != '' -%>
<% elsif ! ['', nil].include?(@serveraliases) -%>
<%= " ServerAlias #{@serveraliases}" %>
<% end -%>
DocumentRoot <%= @docroot %>