Skip to content

Commit

Permalink
Merge pull request #44 from CameronHall/master
Browse files Browse the repository at this point in the history
Fixes #43: Custom rules for local vhosts now work
  • Loading branch information
cytopia committed Dec 6, 2020
2 parents 783bf39 + 6d86e22 commit 824dcd7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions bin/vhost-gen
Expand Up @@ -30,7 +30,7 @@ if os.environ.get("MYPY_CHECK", False):
# --------------------------------------------------------------------------------------------------
APPNAME = "vhost-gen"
APPREPO = "https://github.com/devilbox/vhost-gen"
VERSION = "1.0.2"
VERSION = "1.0.3"
RELDATE = "2020-12-06"

# Default paths
Expand Down Expand Up @@ -766,11 +766,17 @@ def vhost_get_server_status(config, template, verbose):
return output


def vhost_get_custom_section(config, verbose):
# type: (Dict[str, Any], int) -> str
def vhost_get_custom_section(config, template, verbose):
# type: (Dict[str, Any], Dict[str, Any], int) -> str
"""Get virtual host custom directives."""
output = to_str(config["custom"])
log(3, "[custom] Retrieving cfg 'custom': {}".format(output), verbose)
if output:
output += "\n"

if "custom" in template:
output += to_str(template["custom"])

log(3, "[custom] Returning': {}".format(output), verbose)
return output

Expand Down Expand Up @@ -813,7 +819,7 @@ def get_vhost_plain(
"__ALIASES__": str_indent(vhost_get_aliases(config, tpl, verbose), 4),
"__DENIES__": str_indent(vhost_get_denies(config, tpl, verbose), 4),
"__SERVER_STATUS__": str_indent(vhost_get_server_status(config, tpl, verbose), 4),
"__CUSTOM__": str_indent(vhost_get_custom_section(config, verbose), 4),
"__CUSTOM__": str_indent(vhost_get_custom_section(config, tpl, verbose), 4),
},
)

Expand Down Expand Up @@ -853,7 +859,7 @@ def get_vhost_ssl(
"__ALIASES__": str_indent(vhost_get_aliases(config, tpl, verbose), 4),
"__DENIES__": str_indent(vhost_get_denies(config, tpl, verbose), 4),
"__SERVER_STATUS__": str_indent(vhost_get_server_status(config, tpl, verbose), 4),
"__CUSTOM__": str_indent(vhost_get_custom_section(config, verbose), 4),
"__CUSTOM__": str_indent(vhost_get_custom_section(config, tpl, verbose), 4),
},
)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -6,7 +6,7 @@

setup(
name="vhost-gen",
version="1.0.2",
version="1.0.3",
description="Configurable vHost generator for Apache 2.2, Apache 2.4 and Nginx.",
license="MIT",
long_description=long_description,
Expand Down

0 comments on commit 824dcd7

Please sign in to comment.