nginx-lens 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/PKG-INFO +1 -1
  2. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/analyze.py +14 -1
  3. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/diff.py +3 -0
  4. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/graph.py +4 -0
  5. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/health.py +4 -0
  6. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/include.py +4 -0
  7. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/logs.py +12 -2
  8. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/route.py +3 -0
  9. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/syntax.py +8 -2
  10. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/tree.py +5 -0
  11. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/nginx_lens.egg-info/PKG-INFO +1 -1
  12. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/setup.py +1 -2
  13. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/__init__.py +0 -0
  14. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/base.py +0 -0
  15. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/conflicts.py +0 -0
  16. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/dead_locations.py +0 -0
  17. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/diff.py +0 -0
  18. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/duplicates.py +0 -0
  19. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/empty_blocks.py +0 -0
  20. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/include.py +0 -0
  21. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/rewrite.py +0 -0
  22. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/route.py +0 -0
  23. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/unused.py +0 -0
  24. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/analyzer/warnings.py +0 -0
  25. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/__init__.py +0 -0
  26. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/commands/cli.py +0 -0
  27. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/exporter/__init__.py +0 -0
  28. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/exporter/graph.py +0 -0
  29. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/exporter/html.py +0 -0
  30. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/exporter/markdown.py +0 -0
  31. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/nginx_lens.egg-info/SOURCES.txt +0 -0
  32. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/nginx_lens.egg-info/dependency_links.txt +0 -0
  33. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/nginx_lens.egg-info/entry_points.txt +0 -0
  34. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/nginx_lens.egg-info/requires.txt +0 -0
  35. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/nginx_lens.egg-info/top_level.txt +0 -0
  36. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/parser/__init__.py +0 -0
  37. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/parser/nginx_parser.py +0 -0
  38. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/pyproject.toml +0 -0
  39. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/setup.cfg +0 -0
  40. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/tests/test_conflicts.py +0 -0
  41. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/tests/test_duplicates.py +0 -0
  42. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/tests/test_empty_blocks.py +0 -0
  43. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/tests/test_health.py +0 -0
  44. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/tests/test_parser.py +0 -0
  45. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/upstream_checker/__init__.py +0 -0
  46. {nginx_lens-0.1.2 → nginx_lens-0.1.4}/upstream_checker/checker.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nginx-lens
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: CLI-инструмент для анализа, визуализации и диагностики конфигураций Nginx
5
5
  Author: Daniil Astrouski
6
6
  Author-email: shelovesuastra@gmail.com
@@ -15,7 +15,20 @@ console = Console()
15
15
 
16
16
  def analyze(config_path: str = typer.Argument(..., help="Путь к nginx.conf")):
17
17
  """
18
- Анализирует конфигурацию Nginx на типовые проблемы. Выводит таблицу issue_type/issue_description.
18
+ Анализирует конфигурацию Nginx на типовые проблемы и best practices.
19
+
20
+ Показывает:
21
+ - Конфликты location-ов
22
+ - Дублирующиеся директивы
23
+ - Пустые блоки
24
+ - Потенциальные проблемы (proxy_pass без схемы, autoindex on, if, server_tokens on, SSL, лимиты, deprecated и др.)
25
+ - Неиспользуемые переменные
26
+ - Конфликты listen/server_name
27
+ - Проблемы с rewrite
28
+ - Мертвые location-ы
29
+
30
+ Пример:
31
+ nginx-lens analyze /etc/nginx/nginx.conf
19
32
  """
20
33
  tree = parse_nginx_config(config_path)
21
34
  conflicts = find_location_conflicts(tree)
@@ -13,6 +13,9 @@ def diff(
13
13
  ):
14
14
  """
15
15
  Сравнивает две конфигурации Nginx и выводит отличия side-by-side.
16
+
17
+ Пример:
18
+ nginx-lens diff /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
16
19
  """
17
20
  tree1 = parse_nginx_config(config1)
18
21
  tree2 = parse_nginx_config(config2)
@@ -12,6 +12,10 @@ def graph(
12
12
  ):
13
13
  """
14
14
  Генерирует схему маршрутизации nginx (dot/mermaid).
15
+
16
+ Пример:
17
+ nginx-lens graph /etc/nginx/nginx.conf --format dot
18
+ nginx-lens graph /etc/nginx/nginx.conf --format mermaid
15
19
  """
16
20
  tree = parse_nginx_config(config_path)
17
21
  if format == "dot":
@@ -14,6 +14,10 @@ def health(
14
14
  ):
15
15
  """
16
16
  Проверяет доступность upstream-серверов, определённых в nginx.conf. Выводит таблицу.
17
+
18
+ Пример:
19
+ nginx-lens health /etc/nginx/nginx.conf
20
+ nginx-lens health /etc/nginx/nginx.conf --timeout 5 --retries 3
17
21
  """
18
22
  tree = parse_nginx_config(config_path)
19
23
  upstreams = tree.get_upstreams()
@@ -13,6 +13,10 @@ def include_tree(
13
13
  ):
14
14
  """
15
15
  Показывает дерево include-ов, циклы и shadowing директив.
16
+
17
+ Пример:
18
+ nginx-lens include-tree /etc/nginx/nginx.conf
19
+ nginx-lens include-tree /etc/nginx/nginx.conf --directive server_name
16
20
  """
17
21
  tree = build_include_tree(config_path)
18
22
  rich_tree = Tree(f"[bold blue]{config_path}[/bold blue]")
@@ -4,7 +4,7 @@ from rich.table import Table
4
4
  import re
5
5
  from collections import Counter, defaultdict
6
6
 
7
- app = typer.Typer()
7
+ app = typer.Typer(help="Анализ access.log/error.log: топ-статусы, пути, IP, User-Agent, ошибки.")
8
8
  console = Console()
9
9
 
10
10
  log_line_re = re.compile(r'(?P<ip>\S+) \S+ \S+ \[(?P<time>[^\]]+)\] "(?P<method>\S+) (?P<path>\S+) [^\"]+" (?P<status>\d{3})')
@@ -15,7 +15,17 @@ def logs(
15
15
  top: int = typer.Option(10, help="Сколько топ-значений выводить")
16
16
  ):
17
17
  """
18
- Анализирует access.log/error.log: топ-404, топ-500, частые запросы, подозрительные user-agent, IP.
18
+ Анализирует access.log/error.log.
19
+
20
+ Показывает:
21
+ - Топ HTTP-статусов (404, 500 и др.)
22
+ - Топ путей
23
+ - Топ IP-адресов
24
+ - Топ User-Agent
25
+ - Топ путей с ошибками 404/500
26
+
27
+ Пример:
28
+ nginx-lens logs /var/log/nginx/access.log --top 20
19
29
  """
20
30
  status_counter = Counter()
21
31
  path_counter = Counter()
@@ -13,6 +13,9 @@ def route(
13
13
  ):
14
14
  """
15
15
  Показывает, какой server/location обслуживает указанный URL.
16
+
17
+ Пример:
18
+ nginx-lens route /etc/nginx/nginx.conf http://example.com/api/v1
16
19
  """
17
20
  tree = parse_nginx_config(config_path)
18
21
  res = find_route(tree, url)
@@ -5,7 +5,7 @@ import subprocess
5
5
  import os
6
6
  import re
7
7
 
8
- app = typer.Typer()
8
+ app = typer.Typer(help="Проверка синтаксиса nginx-конфига через nginx -t с подсветкой ошибок.")
9
9
  console = Console()
10
10
 
11
11
  ERROR_RE = re.compile(r'in (.+?):(\d+)')
@@ -16,7 +16,13 @@ def syntax(
16
16
  nginx_path: str = typer.Option("nginx", help="Путь к бинарю nginx (по умолчанию 'nginx')")
17
17
  ):
18
18
  """
19
- Проверяет синтаксис nginx-конфига через nginx -t. В случае ошибки показывает место в виде таблицы.
19
+ Проверяет синтаксис nginx-конфига через nginx -t.
20
+
21
+ В случае ошибки показывает место в виде таблицы с контекстом.
22
+
23
+ Пример:
24
+ nginx-lens syntax /etc/nginx/nginx.conf
25
+ nginx-lens syntax /etc/nginx/nginx.conf --nginx-path /usr/local/sbin/nginx
20
26
  """
21
27
  cmd = [nginx_path, "-t", "-c", os.path.abspath(config_path)]
22
28
  try:
@@ -28,6 +28,11 @@ def tree(
28
28
  ):
29
29
  """
30
30
  Визуализирует структуру nginx.conf в виде дерева.
31
+
32
+ Пример:
33
+ nginx-lens tree /etc/nginx/nginx.conf
34
+ nginx-lens tree /etc/nginx/nginx.conf --markdown
35
+ nginx-lens tree /etc/nginx/nginx.conf --html
31
36
  """
32
37
  tree_obj = parse_nginx_config(config_path)
33
38
  root = RichTree(f"[bold blue]nginx.conf[/bold blue]")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nginx-lens
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: CLI-инструмент для анализа, визуализации и диагностики конфигураций Nginx
5
5
  Author: Daniil Astrouski
6
6
  Author-email: shelovesuastra@gmail.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="nginx-lens",
5
- version="0.1.2",
5
+ version="0.1.4",
6
6
  description="CLI-инструмент для анализа, визуализации и диагностики конфигураций Nginx",
7
7
  author="Daniil Astrouski",
8
8
  author_email="shelovesuastra@gmail.com",
@@ -12,7 +12,6 @@ setup(
12
12
  "typer[all]>=0.9.0",
13
13
  "rich>=13.0.0",
14
14
  "requests>=2.25.0",
15
- # "textual>=0.30.0", # опционально для интерактивного режима
16
15
  ],
17
16
  entry_points={
18
17
  "console_scripts": [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes