19 lines
668 B
Python
Executable file
19 lines
668 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
INCLUDE_MATCH = re.compile(r"\s*include\s+(.*)\s*")
|
|
SERVERNAME_MATCH = re.compile(r"\s*ServerName\s+(.*)\s*")
|
|
SERVERALIAS_MATCH = re.compile(r"\s*ServerAlias\s+(.*)\s*")
|
|
|
|
with Path(sys.argv[1]).open("r") as original:
|
|
lines = original.readlines()
|
|
includes = set(x[1] for x in map(INCLUDE_MATCH.match, lines) if x)
|
|
server_name = set(x[1] for x in map(SERVERNAME_MATCH.match, lines) if x)
|
|
server_alias = set(x[1] for x in map(SERVERALIAS_MATCH.match, lines) if x)
|
|
print(f"includes: {includes}")
|
|
print(f"server_name: {server_name}")
|
|
print(f"server_alias: {server_alias}")
|