add prefix to rules for easy identification
Build and Push Container / build-and-push (push) Successful in 18s
Build and Push Container / build-and-push (push) Successful in 18s
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
## Dev commands (always run all three)
|
||||
|
||||
```bash
|
||||
uv run pytest -v # 35 tests, all mocked (no live API calls)
|
||||
uv run pytest -v # 50 tests, all mocked (no live API calls)
|
||||
uv run ruff check # lint
|
||||
uv run pyright # strict type checking
|
||||
```
|
||||
@@ -13,12 +13,15 @@ Order matters: fix lint/typecheck errors before touching tests.
|
||||
## Architecture
|
||||
|
||||
- `main.py` — entry point: load config → fetch public IPs → process rules → NTFY notify
|
||||
- `config.py` — app constants (e.g., `RULE_NAME_PREFIX`)
|
||||
- `unifi_firewall.py` — UniFi Network API v1 client (TypedDicts match `network_v10.4.57_openapi.json`)
|
||||
- `ip_lookup.py` — fetches public IPv4/IPv6 via `curl ifconfig.me`
|
||||
- `config/rules.yaml` — rule definitions (zones, IPs, ports, actions)
|
||||
|
||||
API base: `{UNIFI_HOST}/proxy/network/integration/v1/sites/{UNIFI_SITE_ID}`. Auth: `X-API-Key` header.
|
||||
|
||||
Rule names from `config/rules.yaml` are prefixed with `AUTO-` at runtime (`config.py:RULE_NAME_PREFIX`). First run migrates any existing unprefixed rules by renaming them.
|
||||
|
||||
## Env vars
|
||||
|
||||
Required: `UNIFI_HOST`, `UNIFI_SITE_ID`, `UNIFI_API_TOKEN`
|
||||
|
||||
Reference in New Issue
Block a user