Skip to content

Commit c99d969

Browse files
committed
Simplify the syntax for boolean arguments
As suggested by @ekohl during review.
1 parent bb215d0 commit c99d969

File tree

1 file changed

+14
-35
lines changed

1 file changed

+14
-35
lines changed

templates/vhost/_directories.erb

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -299,50 +299,32 @@
299299
AuthLDAPGroupAttribute <%= groupattr %>
300300
<%- end -%>
301301
<%- end -%>
302-
<%- if directory['auth_ldap_group_attribute_is_dn'] == 'off' -%>
303-
AuthLDAPGroupAttributeIsDN Off
304-
<%- end -%>
305-
<%- if directory['auth_ldap_group_attribute_is_dn'] == 'on' -%>
306-
AuthLDAPGroupAttributeIsDN On
302+
<%- unless directory['auth_ldap_group_attribute_is_dn'].nil? -%>
303+
AuthLDAPGroupAttributeIsDN <%= scope.call_function('apache::bool2httpd', [ directory['auth_ldap_group_attribute_is_dn'] ]) %>
307304
<%- end -%>
308305
<%- if directory['auth_ldap_initial_bind_pattern'] -%>
309306
AuthLDAPInitialBindPattern <%= directory['auth_ldap_initial_bind_pattern'] %>
310307
<%- end -%>
311-
<%- if directory['auth_ldap_bind_as_user'] == 'off' -%>
312-
AuthLDAPInitialBindAsUser Off
313-
<%- end -%>
314-
<%- if directory['auth_ldap_bind_as_user'] == 'on' -%>
315-
AuthLDAPInitialBindAsUser On
316-
<%- end -%>
317-
<%- if directory['auth_ldap_compare_as_user'] == 'off' -%>
318-
AuthLDAPCompareAsUser Off
319-
<%- end -%>
320-
<%- if directory['auth_ldap_compare_as_user'] == 'on' -%>
321-
AuthLDAPCompareAsUser On
308+
<%- unless directory['auth_ldap_bind_as_user'].nil? -%>
309+
AuthLDAPInitialBindAsUser <%= scope.call_function('apache::bool2httpd', [ directory['auth_ldap_bind_as_user'] ]) %>
322310
<%- end -%>
323-
<%- if directory['auth_ldap_search_as_user'] == 'off' -%>
324-
AuthLDAPSearchAsUser Off
311+
<%- unless directory['auth_ldap_compare_as_user'].nil? -%>
312+
AuthLDAPCompareAsUser <%= scope.call_function('apache::bool2httpd', [ directory['auth_ldap_compare_as_user'] ]) %>
325313
<%- end -%>
326-
<%- if directory['auth_ldap_search_as_user'] == 'on' -%>
327-
AuthLDAPSearchAsUser On
314+
<%- unless directory['auth_ldap_search_as_user'].nil? -%>
315+
AuthLDAPSearchAsUser <%= scope.call_function('apache::bool2httpd', [ directory['auth_ldap_search_as_user'] ]) %>
328316
<%- end -%>
329-
<%- if directory['auth_ldap_bind_authoritative'] == 'off' -%>
330-
AuthLDAPBindAuthoritative Off
331-
<%- end -%>
332-
<%- if directory['auth_ldap_bind_authoritative'] == 'on' -%>
333-
AuthLDAPBindAuthoritative On
317+
<%- unless directory['auth_ldap_bind_authoritative'].nil? -%>
318+
AuthLDAPBindAuthoritative <%= scope.call_function('apache::bool2httpd', [ directory['auth_ldap_bind_authoritative'] ]) %>
334319
<%- end -%>
335320
<%- if directory['auth_ldap_authorize_prefix'] -%>
336321
AuthLDAPAuthorizePrefix <%= directory['auth_ldap_authorize_prefix'] %>
337322
<%- end -%>
338323
<%- if directory['auth_ldap_charset_config'] -%>
339324
AuthLDAPCharsetConfig <%= directory['auth_ldap_charset_config'] %>
340325
<%- end -%>
341-
<%- if directory['auth_ldap_compare_dn_on_server'] == 'off' -%>
342-
AuthLDAPCompareDNOnServer Off
343-
<%- end -%>
344-
<%- if directory['auth_ldap_compare_dn_on_server'] == 'on' -%>
345-
AuthLDAPCompareDNOnServer On
326+
<%- unless directory['auth_ldap_compare_dn_on_server'].nil? -%>
327+
AuthLDAPCompareDNOnServer <%= scope.call_function('apache::bool2httpd', [ directory['auth_ldap_compare_dn_on_server'] ]) %>
346328
<%- end -%>
347329
<%- if directory['auth_ldap_dereference_aliases'] -%>
348330
AuthLDAPDereferenceAliases <%= directory['auth_ldap_dereference_aliases'] %>
@@ -353,11 +335,8 @@
353335
<%- if directory['auth_ldap_remote_user_attribute'] -%>
354336
AuthLDAPRemoteUserAttribute <%= directory['auth_ldap_remote_user_attribute'] %>
355337
<%- end -%>
356-
<%- if directory['auth_ldap_remote_user_is_dn'] == 'off' -%>
357-
AuthLDAPRemoteUserIsDN Off
358-
<%- end -%>
359-
<%- if directory['auth_ldap_remote_user_is_dn'] == 'on' -%>
360-
AuthLDAPRemoteUserIsDN On
338+
<%- unless directory['auth_ldap_remote_user_is_dn'].nil? -%>
339+
AuthLDAPRemoteUserIsDN <%= scope.call_function('apache::bool2httpd', [ directory['auth_ldap_remote_user_is_dn'] ]) %>
361340
<%- end -%>
362341
<%- if directory['auth_ldap_sub_group_attribute'] -%>
363342
AuthLDAPSubGroupAttribute <%= directory['auth_ldap_sub_group_attribute'] %>

0 commit comments

Comments
 (0)