puppetlabs-apache
puppetlabs-apache copied to clipboard
Display of RewriteRule in vhost config files
Use Case
When I define multiple RewriteRule, they are not very well displayed in the config file, there is too much space between them and there is no sense they are related to each other…
apache::vhost { 'example.com':
rewrites => [
{
comment => 'Example rules 1',
rewrite_rule => [
'"\/(foo\/)" - [F]',
'"\/(bar\/)" - [F]',
'"\/(baz\/)" - [F]',
'"\/(qux\/)" - [F]',
'"\/(quux\/)" - [F]',
],
},
{
comment => 'Example rules 2',
rewrite_rule => [
'"\/(another_foo\/)" - [F]',
'"\/(another_bar\/)" - [F]',
'"\/(another_baz\/)" - [F]',
'"\/(another_qux\/)" - [F]',
'"\/(another_quux\/)" - [F]',
],
},
],
}
[...]
# Example rules 1
RewriteRule "(\/foo\/)" - [F]
RewriteRule "(\/bar\/)" - [F]
RewriteRule "(\/baz\/)" - [F]
RewriteRule "(\/qux\/)" - [F]
RewriteRule "(\/quux\/)" - [F]
# Example rules 2
RewriteRule "(\/another_foo\/)" - [F]
RewriteRule "(\/another_bar\/)" - [F]
RewriteRule "(\/another_baz\/)" - [F]
RewriteRule "(\/another_qux\/)" - [F]
RewriteRule "(\/another_quux\/)" - [F]
Describe the Solution You Would Like
I feel these RewriteRule should not be this much spaced. I think this would be much more readable:
# Example rules 1
RewriteRule "(\/foo\/)" - [F]
RewriteRule "(\/bar\/)" - [F]
RewriteRule "(\/baz\/)" - [F]
RewriteRule "(\/qux\/)" - [F]
RewriteRule "(\/quux\/)" - [F]
# Example rules 2
RewriteRule "(\/another_foo\/)" - [F]
RewriteRule "(\/another_bar\/)" - [F]
RewriteRule "(\/another_baz\/)" - [F]
RewriteRule "(\/another_qux\/)" - [F]
RewriteRule "(\/another_quux\/)" - [F]
Describe Alternatives You've Considered
Not caring about how the config file looks!
Additional Context
Other related config seems grouped together, for example when there is TLS config:
## SSL directives
SSLEngine on
SSLCertificateFile "/etc/pki/tls/certs/example.com.crt"
SSLCertificateKeyFile "/etc/pki/tls/private/example.com.key"
SSLCACertificateFile "/etc/pki/tls/certs/ca-bundle.crt"
It’s pretty basic change, the CR is wrongly placed in the template in my opinion, i’ll provide a quick PR