config load summary + safer windows defaults
This commit is contained in:
parent
a4b56c74c7
commit
853ae6386c
@ -1102,7 +1102,8 @@ def main(argv: Optional[list[str]] = None) -> None:
|
|||||||
if da:
|
if da:
|
||||||
argv.extend(["--qr"])
|
argv.extend(["--qr"])
|
||||||
if ANYWIN or not os.geteuid():
|
if ANYWIN or not os.geteuid():
|
||||||
argv.extend(["-p80,443,3923", "--ign-ebind"])
|
# win10 allows symlinks if admin; can be unexpected
|
||||||
|
argv.extend(["-p80,443,3923", "--ign-ebind", "--no-dedup"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -1003,6 +1003,18 @@ class AuthSrv(object):
|
|||||||
lns: list[str] = []
|
lns: list[str] = []
|
||||||
try:
|
try:
|
||||||
self._parse_config_file(cfg_fn, lns, acct, daxs, mflags, mount)
|
self._parse_config_file(cfg_fn, lns, acct, daxs, mflags, mount)
|
||||||
|
|
||||||
|
zs = "#\033[36m cfg files in "
|
||||||
|
zst = [x[len(zs) :] for x in lns if x.startswith(zs)]
|
||||||
|
for zs in list(set(zst)):
|
||||||
|
self.log("discovered config files in " + zs, 6)
|
||||||
|
|
||||||
|
zs = "#\033[36m opening cfg file"
|
||||||
|
zstt = [x.split(" -> ") for x in lns if x.startswith(zs)]
|
||||||
|
zst = [(max(0, len(x) - 2) * " ") + "└" + x[-1] for x in zstt]
|
||||||
|
t = "loaded {} config files:\n{}"
|
||||||
|
self.log(t.format(len(zst), "\n".join(zst)))
|
||||||
|
|
||||||
except:
|
except:
|
||||||
lns = lns[: self.line_ctr]
|
lns = lns[: self.line_ctr]
|
||||||
slns = ["{:4}: {}".format(n, s) for n, s in enumerate(lns, 1)]
|
slns = ["{:4}: {}".format(n, s) for n, s in enumerate(lns, 1)]
|
||||||
@ -1752,13 +1764,13 @@ def split_cfg_ln(ln: str) -> dict[str, Any]:
|
|||||||
def expand_config_file(ret: list[str], fp: str, ipath: str) -> None:
|
def expand_config_file(ret: list[str], fp: str, ipath: str) -> None:
|
||||||
"""expand all % file includes"""
|
"""expand all % file includes"""
|
||||||
fp = absreal(fp)
|
fp = absreal(fp)
|
||||||
ipath += " -> " + fp
|
|
||||||
ret.append("#\033[36m opening cfg file{}\033[0m".format(ipath))
|
|
||||||
if len(ipath.split(" -> ")) > 64:
|
if len(ipath.split(" -> ")) > 64:
|
||||||
raise Exception("hit max depth of 64 includes")
|
raise Exception("hit max depth of 64 includes")
|
||||||
|
|
||||||
if os.path.isdir(fp):
|
if os.path.isdir(fp):
|
||||||
for fn in sorted(os.listdir(fp)):
|
names = os.listdir(fp)
|
||||||
|
ret.append("#\033[36m cfg files in {} => {}\033[0m".format(fp, names))
|
||||||
|
for fn in sorted(names):
|
||||||
fp2 = os.path.join(fp, fn)
|
fp2 = os.path.join(fp, fn)
|
||||||
if not fp2.endswith(".conf") or fp2 in ipath:
|
if not fp2.endswith(".conf") or fp2 in ipath:
|
||||||
continue
|
continue
|
||||||
@ -1766,6 +1778,9 @@ def expand_config_file(ret: list[str], fp: str, ipath: str) -> None:
|
|||||||
expand_config_file(ret, fp2, ipath)
|
expand_config_file(ret, fp2, ipath)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
ipath += " -> " + fp
|
||||||
|
ret.append("#\033[36m opening cfg file{}\033[0m".format(ipath))
|
||||||
|
|
||||||
with open(fp, "rb") as f:
|
with open(fp, "rb") as f:
|
||||||
for oln in [x.decode("utf-8").rstrip() for x in f]:
|
for oln in [x.decode("utf-8").rstrip() for x in f]:
|
||||||
ln = oln.split(" #")[0].strip()
|
ln = oln.split(" #")[0].strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user