MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / clean_conf

Function clean_conf

bota/src/bota/apache_utils.py:12–18  ·  view source on GitHub ↗
(apache_conf, root_path)

Source from the content-addressed store, hash-verified

10 return read_file("/etc/apache2/sites-available/000-default.conf")
11
12def clean_conf(apache_conf, root_path):
13 apache_conf = re.sub(r'\n\s.*ProxyPass\s+' + re.escape(root_path) + r'\s+.*\n', '\n', apache_conf)
14 apache_conf = re.sub(r'ProxyPass\s+' + re.escape(root_path) + r'\s+.*\n', '', apache_conf)
15 apache_conf = re.sub(r'\n\s.*ProxyPassReverse\s+' + re.escape(root_path) + r'\s+.*\n', '\n', apache_conf)
16 apache_conf = re.sub(r'ProxyPassReverse\s+' + re.escape(root_path) + r'\s+.*\n', '', apache_conf)
17 # return apache_conf
18 return re.sub(r'[ \t]+</VirtualHost>', '</VirtualHost>', apache_conf)
19
20def collapse_empty_lines(conf: str) -> str:
21 # Replace multiple consecutive newlines (with optional whitespace) with a single newline

Callers 2

make_apache_contentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected