Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
genconfig
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hemio e. V.
genconfig
Commits
a323ccb6
Commit
a323ccb6
authored
Dec 22, 2019
by
Sophie Herold
🌼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust apache2 filter for ACME
parent
9f7db8ca
Pipeline
#1855
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
genconfig/filters.py
genconfig/filters.py
+16
-14
No files found.
genconfig/filters.py
View file @
a323ccb6
...
...
@@ -442,31 +442,33 @@ class to_gshadow_line(base.Filter):
return
'to_gshadow_line()'
class
to_apache2_vhost
(
base
.
Filter
):
"""Converts a dictionary containing the keys 'address4'
or 'address6' into a apache2 config vhost. More options
listed in config_keys can be given in the dict."""
template_vhost
=
"""
<VirtualHost *:{port}>
Use GenconfigVhostDefaults "{user}" "{domain}" "{port}" "{aliases}"
{addons}</VirtualHost>
</VirtualHost>
"""
template_vhost_ssl
=
"""
MDomain "{domain}"
<VirtualHost *:{port}>
Use GenconfigVhostDefaults "{user}" "{domain}" "{port}" "{aliases}"
SSLEngine On
</VirtualHost>
"""
template_ssl
=
' Use GenconfigVhostSsl "{domain}" "{port}" "{https}"
\n
'
template_redirect
=
' Redirect permanent / {option[redirect_url]}
\n
'
def
__next__
(
self
):
chunk
=
self
.
_chunk
chunk
[
'addons'
]
=
''
if
chunk
[
'https'
]
is
not
None
:
chunk
[
'addons'
]
+=
self
.
template_ssl
.
format
(
**
chunk
)
res
=
""
if
chunk
[
'subservice'
]
==
'http_redirect'
:
chunk
[
'addons'
]
+=
self
.
template_redirect
.
format
(
**
chunk
)
if
chunk
[
'https'
]:
res
+=
self
.
template_vhost_ssl
.
format
(
**
chunk
)
if
chunk
[
'port'
]
==
443
:
res
+=
self
.
template_vhost
.
format
(
**
{
**
chunk
,
'port'
:
80
})
else
:
res
+=
self
.
template_vhost
.
format
(
**
chunk
)
return
self
.
template_vhost
.
format
(
**
chunk
)
return
res
def
__str__
(
self
):
return
'to_apache2_vhost()'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment