Add centralized constants module and .env configuration support
This commit is contained in:
1 parent
94be1da199
commit
eea5ef6885
14 files changed
+334
-126
No files matched your search
+4
-3
@@ -19,6 +19,7 @@ from .ip_utils import is_whitelisted, split_versions
|
||||
from .mikrotik import write_mikrotik
|
||||
from .models import IPStats, Request, aggregate
|
||||
from .reporting import Column, columns_header, columns_row, render_kv, render_table, timestamp_name
|
||||
from .constants import DEFAULT_TOP, DEFAULT_TOP_PATHS
|
||||
from .whitelists import refresh_whitelists
|
||||
|
||||
|
||||
@@ -42,7 +43,7 @@ class Analyzer:
|
||||
flag_label = "Flagged IPs"
|
||||
flag_note = ""
|
||||
|
||||
def __init__(self, log_path: str, report_dir: str, top: int = 30,
|
||||
def __init__(self, log_path: str, report_dir: str, top: int = DEFAULT_TOP,
|
||||
quiet: bool = False, write_rsc: bool = True):
|
||||
self.log_path = log_path
|
||||
self.report_dir = report_dir
|
||||
@@ -150,8 +151,8 @@ class Analyzer:
|
||||
out.append(f"... {len(self.stats) - self.top} more IPs omitted")
|
||||
out.append("")
|
||||
|
||||
out.append(f"== top 20 {self.paths_label} ==")
|
||||
for path, n in self.error_paths().most_common(20):
|
||||
out.append(f"== top {DEFAULT_TOP_PATHS} {self.paths_label} ==")
|
||||
for path, n in self.error_paths().most_common(DEFAULT_TOP_PATHS):
|
||||
out.append(f" {n:>5} {path}")
|
||||
out.append("")
|
||||
|
||||
|
||||
Reference in new issue
Block a user