Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3135db3aa9 | ||
|
|
b3ff2870b0 | ||
|
|
e2d3c72ba2 | ||
|
|
44da986315 | ||
|
|
e896244524 | ||
|
|
4c51188ee5 | ||
|
|
89a35a6dff | ||
|
|
b452c60434 | ||
|
|
11eab55198 | ||
|
|
7fb9bf0806 | ||
|
|
d31edee091 | ||
|
|
6e5b19eb25 | ||
|
|
ff733ccdee | ||
|
|
1306db07ab | ||
|
|
49ad809016 | ||
|
|
21e22caa61 | ||
|
|
0ec1c208d8 | ||
|
|
cc02dc28e4 | ||
|
|
faa947f3b7 | ||
|
|
a038ccf78a | ||
|
|
d80a7aa71a | ||
|
|
726a618483 | ||
|
|
31ec0825fa |
No files matched your search
@@ -18,7 +18,7 @@ jobs:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: gitleaks
|
||||
uses: https://git.rfa.cz/tth-pub/ci-actions/gitleaks@v11
|
||||
uses: https://git.rfa.cz/tth-pub/ci-actions/gitleaks@v15
|
||||
with:
|
||||
mode: block
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Trivy config
|
||||
uses: https://git.rfa.cz/tth-pub/ci-actions/trivy-gate@v11
|
||||
uses: https://git.rfa.cz/tth-pub/ci-actions/trivy-gate@v15
|
||||
with:
|
||||
scan-type: fs
|
||||
scanners: misconfig
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
docker run --rm --platform "linux/${{ matrix.arch }}" "$img" --help | grep -q -- --repeaters
|
||||
|
||||
- name: Trivy gate
|
||||
uses: https://git.rfa.cz/tth-pub/ci-actions/trivy-gate@v11
|
||||
uses: https://git.rfa.cz/tth-pub/ci-actions/trivy-gate@v15
|
||||
with:
|
||||
image: ${{ env.IMAGE }}:${{ github.sha }}-${{ matrix.arch }}
|
||||
username: ${{ gitea.actor }}
|
||||
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- name: Dependencies in the tree
|
||||
uses: https://git.rfa.cz/tth-pub/ci-actions/trivy-gate@v11
|
||||
uses: https://git.rfa.cz/tth-pub/ci-actions/trivy-gate@v15
|
||||
with:
|
||||
scan-type: fs
|
||||
mode: warn
|
||||
@@ -11,9 +11,9 @@ README.md has the full reference. This file is the procedure and the rules.
|
||||
`set radio`, `advert`, `reboot`, `erase` or any other CLI command to a
|
||||
node, with meshcli or anything else. A repeater is part of a community
|
||||
network; a wrong setting breaks routing for other people.
|
||||
2. **Keep the default interval (3600 s).** Shorter only if the user explicitly
|
||||
2. **Keep the default interval (28800 s, 8 h).** Shorter only if the user explicitly
|
||||
asks for it and understands it costs shared airtime (point them to
|
||||
https://meshcore.repeater.cz/nastaveni/telemetrie/). Never below 900 (the
|
||||
https://meshcore.repeater.cz/nastaveni/telemetrie/). Never below 3600 (the
|
||||
program refuses).
|
||||
3. **Passwords** go into `stack/.env` or `repeaters.toml` only (both are
|
||||
git-ignored), never into a command you print, a commit, a log or an
|
||||
@@ -35,6 +35,9 @@ README.md has the full reference. This file is the procedure and the rules.
|
||||
README section 3 (a dedicated companion identity over TCP). Changing their
|
||||
openHop config.yaml is a change to their node: show the block, let them
|
||||
apply it.
|
||||
One companion they also use from a phone app, no openHop: README section 4
|
||||
(coresplitter shares it). It must be built from source; offer it, do not
|
||||
install a Rust toolchain without asking.
|
||||
**Find out the operating system first.** Docker Desktop on macOS and
|
||||
Windows cannot pass a USB device into a container: there, use section 2
|
||||
(pipx) for the exporter, never the Docker stack with a USB board.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM python:3.15-slim@sha256:8c13a3f37a6a5b71498228e902c4b9f51c1f7900d49fabf71f9a650c6120e0d0
|
||||
FROM python:3.15-slim@sha256:65a65fc7b30b06cb6df4930fd4650697cb23f4c2698ab81fc87e4b031bc36928
|
||||
|
||||
# Re-runs the security-update layer once a day despite the layer cache (CI
|
||||
# passes the date).
|
||||
|
||||
@@ -11,18 +11,28 @@ repeater ))) mesh ((( companion rádio ── USB ── meshcore-exporter ─
|
||||

|
||||
|
||||
Companion rádio (libovolná MeshCore deska s companion firmwarem, připojená
|
||||
k počítači) se jednou za hodinu přihlásí na repeater, vyžádá si stav
|
||||
k počítači) se jednou za 8 hodin přihlásí na repeater, vyžádá si stav
|
||||
a telemetrii přímými pakety a exportér to vystaví na `:9200/metrics`.
|
||||
|
||||
> [!WARNING]
|
||||
> **Každé čtení vysílá do sdíleného éteru.** Jedno čtení repeateru zabere
|
||||
> zhruba 0,8 s kanálu, o který se dělí všichni v okolí, a v tu chvíli
|
||||
> nikdo jiný nevysílá. Proto exportér čte jednou za 8 hodin a pod hodinu
|
||||
> nejde. Interval nezkracujte bez opravdového důvodu: baterie, teplota ani
|
||||
> šum se za pár minut nezmění. Víc v sekci [Kolik to stojí éteru](#kolik-to-stojí-éteru).
|
||||
|
||||
*English: a Prometheus exporter that logs in to MeshCore repeaters over the
|
||||
mesh from a companion radio (USB, TCP or BLE) and exports status and
|
||||
telemetry. Docs below are Czech; `meshcore-exporter --help` is English.*
|
||||
telemetry. Every reading costs ~0.8 s of a shared channel, hence one reading
|
||||
per 8 hours by default and never more often than hourly. Docs below are
|
||||
Czech; `meshcore-exporter --help` is English.*
|
||||
|
||||
| Mám… | Čtěte |
|
||||
|---|---|
|
||||
| nic, chci hotovou Grafanu | [1. Kompletní stack (Docker)](#1-kompletní-stack-docker) |
|
||||
| vlastní Prometheus a Grafanu | [2. Jen exportér](#2-jen-exportér) |
|
||||
| openHop (repeater nebo observer) a nechci kvůli tomu obětovat desku | [3. Bez vyhrazené desky: openHop](#3-bez-vyhrazené-desky-openhop) |
|
||||
| jeden companion a chci ho dál používat i z telefonu | [4. Sdílený companion: coresplitter](#4-sdílený-companion-coresplitter) |
|
||||
| AI agenta, který to rozjede za mě | dejte mu tohle repo; pravidla pro něj jsou v [AGENTS.md](AGENTS.md) |
|
||||
|
||||
## Co je potřeba
|
||||
@@ -77,7 +87,7 @@ desku do kontejneru nepředá, tam použijte [2.](#2-jen-exportér).
|
||||
Grafana poběží na `http://<počítač>:3000` (uživatel `admin`, heslo
|
||||
z `.env`), dashboard **MeshCore — repeater** je domovská stránka. První
|
||||
čísla jsou tam do minuty, grafy rychlostí (duty cycle, trend baterie) se
|
||||
naplní za pár hodin (počítají se z okna 3 h, proměnná dashboardu **Okno**).
|
||||
naplní až za den (počítají se z okna 24 h, proměnná dashboardu **Okno**).
|
||||
|
||||
Data drží Prometheus 400 dní (`PROMETHEUS_RETENTION` v `.env`).
|
||||
Aktualizace: `docker compose pull && docker compose up -d`. Stack jede na
|
||||
@@ -146,7 +156,7 @@ jedna z nich, rádio sdílí s tím, co na openHopu už běží.
|
||||
node_name: "muj-exporter"
|
||||
tcp_port: 5002
|
||||
bind_address: 127.0.0.1 # companion protokol nemá heslo: jen lokálně
|
||||
tcp_timeout: 0 # exportér drží spojení i hodinu mezi čteními
|
||||
tcp_timeout: 0 # exportér drží spojení i hodiny mezi čteními
|
||||
```
|
||||
|
||||
`tcp_timeout: 0` je nutný: výchozích 120 s by spojení mezi dvěma čteními
|
||||
@@ -161,6 +171,46 @@ jedna z nich, rádio sdílí s tím, co na openHopu už běží.
|
||||
`127.0.0.1`, Grafana na `GRAFANA_PORT` jako jindy. Bez Dockeru stačí
|
||||
exportér podle [2.](#2-jen-exportér) s `--tcp 127.0.0.1:5002`.
|
||||
|
||||
## 4. Sdílený companion: coresplitter
|
||||
|
||||
Companion obslouží jen jednoho klienta, takže bez openHopu je potřeba
|
||||
buď vyhrazená deska, nebo proxy, která jedno rádio rozdělí mezi víc klientů.
|
||||
To umí [coresplitter](https://github.com/ogarcia/coresplitter) (Rust, GPL-3.0):
|
||||
připojí se k rádiu (USB, BLE nebo TCP) a na TCP ho nabídne více klientům
|
||||
najednou. Příkazy řadí do fronty a odpovědi vrací tomu, kdo se ptal; adverty
|
||||
a zprávy posílá všem; kontakty a stav drží v cache.
|
||||
|
||||
```
|
||||
companion ── USB ── coresplitter ──┬── TCP ── meshcore-exporter
|
||||
└── TCP ── aplikace v telefonu (Wi-Fi/TCP připojení)
|
||||
```
|
||||
|
||||
1. coresplitter zatím nevydává hotové binárky ani obrazy, je potřeba si ho
|
||||
přeložit (Rust ≥ 1.85):
|
||||
|
||||
```bash
|
||||
git clone https://github.com/ogarcia/coresplitter.git && cd coresplitter
|
||||
cargo build --release
|
||||
./target/release/coresplitter --serial /dev/serial/by-id/usb-… --tcp-frontend-port 5000
|
||||
```
|
||||
|
||||
Frontend poslouchá výchozí na `0.0.0.0`. Companion protokol nemá heslo,
|
||||
takže kdo se k portu dostane, může přes rádio posílat zprávy: na telefon
|
||||
v domácí síti ho nechte jen tam (firewall), jinak `--tcp-frontend-host 127.0.0.1`.
|
||||
2. Exportér na něj jako na TCP companion:
|
||||
`meshcore-exporter --tcp 127.0.0.1:5000 --repeaters … --password … --check`
|
||||
(ve stacku `MC_TCP=127.0.0.1:5000` a `docker-compose.host.yml` jako u openHopu).
|
||||
|
||||
Ověřeno 2. 11. 2026 přes TCP backend: exportér přečetl repeater, zatímco
|
||||
druhý klient na stejné proxy 90 s bez chyby četl kontakty a stav. S rádiem
|
||||
na USB zatím ne. Dvě věci k vědomí:
|
||||
|
||||
- Když proxy ztratí spojení s rádiem, odpojí všechny klienty a po návratu
|
||||
rádia se připojí znovu. Exportér si to přežije (připojí se znovu za 30 s).
|
||||
- **Na openHop companion coresplitter nedávejte.** openHop pustí jen jednoho
|
||||
klienta na companion a proxy se při znovupřipojení s ostatními přetahuje.
|
||||
Tam stačí přidat další companion identitu ([3.](#3-bez-vyhrazené-desky-openhop)).
|
||||
|
||||
## Nastavení
|
||||
|
||||
Každá volba má tři podoby: přepínač, proměnnou prostředí, klíč v TOML
|
||||
@@ -175,7 +225,7 @@ Přepínač má přednost před proměnnou a ta před souborem.
|
||||
| `--repeaters` | `MC_REPEATERS` | — | `jméno[=pubkey][@cesta]`, víc přes čárku |
|
||||
| `--password` | `MC_PASSWORD` | — | heslo pro `--repeaters` |
|
||||
| `--config` | `MC_CONFIG` | — | TOML s bloky `[[repeater]]` (heslo pro každý zvlášť) |
|
||||
| `--interval` | `MC_INTERVAL` | 3600 | sekundy mezi čteními, minimum 900 |
|
||||
| `--interval` | `MC_INTERVAL` | 28800 | sekundy mezi čteními (8 h), minimum 3600 |
|
||||
| `--path-hash-bytes` | `MC_PATH_HASH_BYTES` | neměnit | šířka hashů cesty companionu; CZ mesh: 2 |
|
||||
| `--rf-timeout` | `MC_RF_TIMEOUT` | 30 | čekání na jednu odpověď |
|
||||
| `--listen`, `--port` | `MC_LISTEN`, `MC_METRICS_PORT` | 0.0.0.0, 9200 | kde vystavit metriky |
|
||||
@@ -206,9 +256,9 @@ Všechny mají label `node` (jméno repeateru).
|
||||
|
||||
Jedno čtení repeateru (status + telemetrie, tam i zpět) zabere na českém
|
||||
nastavení (SF7/62,5 kHz) zhruba 0,8 s kanálu, který sdílí všichni. Výchozí
|
||||
interval je hodina, tedy necelá sekunda za hodinu na repeater. Kratší interval
|
||||
interval je 8 hodin, tedy necelá sekunda za 8 hodin na repeater. Kratší interval
|
||||
přidá provoz všem okolo a nic užitečného nepřinese: baterie, teplota ani šum
|
||||
se za pár minut nezmění. Exportér pod 15 minut nejde.
|
||||
se za pár minut nezmění. Exportér pod hodinu nejde.
|
||||
|
||||
Než interval zkrátíte, zamyslete se, jak často ta data opravdu potřebujete.
|
||||
Dobře to rozebírá návod [Telemetrie, senzory, GPS](https://meshcore.repeater.cz/nastaveni/telemetrie/)
|
||||
@@ -224,7 +274,7 @@ na meshcore.repeater.cz.
|
||||
| `login failed` | špatné heslo — **MeshCore bere jen prvních 15 znaků**, delší heslo se tiše usekne —, nebo odpověď nedoletěla |
|
||||
| jednou `login failed` / `no status reply`, pak `retrying … in 180 s` | ztracená odpověď v éteru, nebo repeater krátce po předchozím přihlášení (např. `--check`) nový login zahodil; exportér to sám zkusí znovu za 3 minuty, nic nedělejte |
|
||||
| `no status reply` | spojení jen jedním směrem: zkuste trasu přes jiný repeater (`@cesta`) |
|
||||
| prázdné nebo zubaté grafy rychlostí | počítají se z okna **Okno** (výchozí 3 h): po startu počkejte pár hodin; při jiném intervalu nastavte okno aspoň na 2–3× interval |
|
||||
| prázdné nebo zubaté grafy rychlostí | počítají se z okna **Okno** (výchozí 24 h): po startu počkejte den; při jiném intervalu nastavte okno aspoň na 2–3× interval |
|
||||
|
||||
Podrobný log: `--log-level DEBUG`.
|
||||
|
||||
|
||||
@@ -164,8 +164,8 @@ panels = [
|
||||
0,
|
||||
"time() - meshcore_last_scrape_success_timestamp{SEL}",
|
||||
"s",
|
||||
steps((None, "green"), (4000, "yellow"), (7500, "red")),
|
||||
"Kdy naposledy uzel odpověděl. Při výchozím intervalu 1 h je normál do ~3600 s.",
|
||||
steps((None, "green"), (30000, "yellow"), (58000, "red")),
|
||||
"Kdy naposledy uzel odpověděl. Při výchozím intervalu 8 h je normál do ~28800 s.",
|
||||
),
|
||||
stat(
|
||||
5, "Fronta TX", 16, 0, "meshcore_queue_length{SEL}", "none", steps((None, "green"), (3, "yellow"), (8, "red"))
|
||||
@@ -346,12 +346,14 @@ dashboard = {
|
||||
"name": "window",
|
||||
"label": "Okno",
|
||||
"type": "custom",
|
||||
"query": "1h,3h,6h,12h",
|
||||
"current": {"text": "3h", "value": "3h"},
|
||||
"options": [{"text": w, "value": w, "selected": w == "3h"} for w in ("1h", "3h", "6h", "12h")],
|
||||
"query": "1h,3h,6h,12h,24h,48h",
|
||||
"current": {"text": "24h", "value": "24h"},
|
||||
"options": [
|
||||
{"text": w, "value": w, "selected": w == "24h"} for w in ("1h", "3h", "6h", "12h", "24h", "48h")
|
||||
],
|
||||
"hide": 0,
|
||||
"description": "Okno pro rychlosti a duty cycle. Data se mění jen při čtení repeateru, "
|
||||
"takže okno má být aspoň 2–3× interval čtení (výchozí 1 h → 3h).",
|
||||
"takže okno má být aspoň 2–3× interval čtení (výchozí 8 h → 24h).",
|
||||
},
|
||||
{
|
||||
"name": "node",
|
||||
|
||||
@@ -41,10 +41,10 @@
|
||||
"name": "window",
|
||||
"label": "Okno",
|
||||
"type": "custom",
|
||||
"query": "1h,3h,6h,12h",
|
||||
"query": "1h,3h,6h,12h,24h,48h",
|
||||
"current": {
|
||||
"text": "3h",
|
||||
"value": "3h"
|
||||
"text": "24h",
|
||||
"value": "24h"
|
||||
},
|
||||
"options": [
|
||||
{
|
||||
@@ -55,7 +55,7 @@
|
||||
{
|
||||
"text": "3h",
|
||||
"value": "3h",
|
||||
"selected": true
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"text": "6h",
|
||||
@@ -66,10 +66,20 @@
|
||||
"text": "12h",
|
||||
"value": "12h",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"text": "24h",
|
||||
"value": "24h",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"text": "48h",
|
||||
"value": "48h",
|
||||
"selected": false
|
||||
}
|
||||
],
|
||||
"hide": 0,
|
||||
"description": "Okno pro rychlosti a duty cycle. Data se mění jen při čtení repeateru, takže okno má být aspoň 2–3× interval čtení (výchozí 1 h → 3h)."
|
||||
"description": "Okno pro rychlosti a duty cycle. Data se mění jen při čtení repeateru, takže okno má být aspoň 2–3× interval čtení (výchozí 8 h → 24h)."
|
||||
},
|
||||
{
|
||||
"name": "node",
|
||||
@@ -304,11 +314,11 @@
|
||||
},
|
||||
{
|
||||
"color": "yellow",
|
||||
"value": 4000
|
||||
"value": 30000
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 7500
|
||||
"value": 58000
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -338,7 +348,7 @@
|
||||
"refId": "A"
|
||||
}
|
||||
],
|
||||
"description": "Kdy naposledy uzel odpověděl. Při výchozím intervalu 1 h je normál do ~3600 s."
|
||||
"description": "Kdy naposledy uzel odpověděl. Při výchozím intervalu 8 h je normál do ~28800 s."
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
|
||||
@@ -7,7 +7,7 @@ on http://<listen>:9200/metrics: battery, temperature, noise floor, RSSI/SNR,
|
||||
packet counters, airtime, uptime, TX queue.
|
||||
|
||||
Every reading costs airtime on a shared channel (~0.8 s per repeater on the
|
||||
Czech preset), so the interval defaults to an hour and cannot go below 15 minutes.
|
||||
Czech preset), so the interval defaults to 8 hours and cannot go below an hour.
|
||||
How often do you really need the numbers? See
|
||||
https://meshcore.repeater.cz/nastaveni/telemetrie/
|
||||
|
||||
@@ -33,10 +33,10 @@ import time
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
__version__ = "1.0.1"
|
||||
__version__ = "1.1.0"
|
||||
|
||||
MIN_INTERVAL = 900
|
||||
DEFAULT_INTERVAL = 3600
|
||||
MIN_INTERVAL = 3600
|
||||
DEFAULT_INTERVAL = 28800
|
||||
# A failed repeater is retried once after this, not after the full interval:
|
||||
# a lost reply on air is common, and a repeater also drops a login whose
|
||||
# timestamp is not newer than the last one from the same client (replay
|
||||
|
||||
@@ -7,7 +7,7 @@ serial = "/dev/serial/by-id/usb-REPLACE_ME-if00" # `ls /dev/serial/by-id/`
|
||||
# ble = "AA:BB:CC:DD:EE:FF" # BLE companion
|
||||
# ble_pin = "123456"
|
||||
|
||||
interval = 3600 # seconds between rounds (min 900)
|
||||
interval = 28800 # seconds between rounds (min 3600)
|
||||
# path_hash_bytes = 2 # Czech mesh: 2
|
||||
|
||||
# Default password for the blocks below that have none. Admin or guest:
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
# Exact versions for the container image; pyproject.toml has the ranges.
|
||||
meshcore==2.3.17
|
||||
meshcore==2.3.19
|
||||
prometheus_client==0.26.0
|
||||
+3
-3
@@ -23,10 +23,10 @@ MC_VERSION=latest
|
||||
MC_REPEATERS=REPLACE_ME
|
||||
# Admin or guest password of the repeater(s). Guest: all but external sensors.
|
||||
MC_PASSWORD=REPLACE_ME
|
||||
# Seconds between readings (min 900). Each reading takes ~1 s of a channel
|
||||
# everyone shares. A battery does not change in minutes: an hour is plenty;
|
||||
# Seconds between readings (min 3600). Each reading takes ~1 s of a channel
|
||||
# everyone shares. A battery does not change in minutes: 8 hours is plenty;
|
||||
# https://meshcore.repeater.cz/nastaveni/telemetrie/
|
||||
MC_INTERVAL=3600
|
||||
MC_INTERVAL=28800
|
||||
# Czech mesh: 2 (width of route hashes in packets this radio sends)
|
||||
MC_PATH_HASH_BYTES=2
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ services:
|
||||
# - ./repeaters.toml:/config/repeaters.toml:ro
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:v3.15.1@sha256:fa3302279710be2f21a8301ec17a8b4f2301fd829bd113839b3b6b02b6f191a2
|
||||
image: prom/prometheus:v3.16.0@sha256:e04987641b57704f408e31f6373ba4138ecf27cb4a165d24aabb6c38fddd0f06
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
@@ -40,7 +40,7 @@ services:
|
||||
- prometheus:/prometheus
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:13.3.0@sha256:488984b716c0862639f91a698adbe2862677a5a07bad42da5f03f3030883b205
|
||||
image: grafana/grafana:13.3.1@sha256:0615ec4fbd4072004b7d86b46ded63013a74b7d6eb1119273dd89e8fa25c13cf
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${GRAFANA_PORT:-3000}:3000"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
global:
|
||||
# The exporter reads the mesh every 15 min; scraping its page more often
|
||||
# The exporter reads the mesh every few hours; scraping its page more often
|
||||
# costs nothing on air and just repeats the last values.
|
||||
scrape_interval: 60s
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ def test_cli_minimal(monkeypatch):
|
||||
|
||||
def test_env_twins(monkeypatch):
|
||||
s = settings(
|
||||
[], monkeypatch, {"MC_TCP": "h:5000", "MC_REPEATERS": "rpt", "MC_INTERVAL": "1800", "MC_PATH_HASH_BYTES": "2"}
|
||||
[], monkeypatch, {"MC_TCP": "h:5000", "MC_REPEATERS": "rpt", "MC_INTERVAL": "7200", "MC_PATH_HASH_BYTES": "2"}
|
||||
)
|
||||
assert s.tcp == "h:5000" and s.interval == 1800 and s.path_hash_bytes == 2
|
||||
assert s.tcp == "h:5000" and s.interval == 7200 and s.path_hash_bytes == 2
|
||||
|
||||
|
||||
def test_interval_floor(monkeypatch):
|
||||
@@ -64,16 +64,16 @@ def test_bad_setup(argv, monkeypatch):
|
||||
def test_toml(tmp_path, monkeypatch):
|
||||
f = tmp_path / "r.toml"
|
||||
f.write_text(
|
||||
'serial = "/dev/y"\ninterval = 1800\npassword = "common"\n'
|
||||
'serial = "/dev/y"\ninterval = 7200\npassword = "common"\n'
|
||||
'[[repeater]]\nname = "one"\n'
|
||||
'[[repeater]]\nname = "two"\npassword = "own"\npath = "5361"\n'
|
||||
)
|
||||
s = settings(["--config", str(f)], monkeypatch)
|
||||
assert s.serial == "/dev/y" and s.interval == 1800
|
||||
assert s.serial == "/dev/y" and s.interval == 7200
|
||||
assert [(t.name, t.password, t.path) for t in s.targets] == [("one", "common", ""), ("two", "own", "5361")]
|
||||
# the command line wins over the file
|
||||
s = settings(["--config", str(f), "--interval", "2400"], monkeypatch)
|
||||
assert s.interval == 2400
|
||||
s = settings(["--config", str(f), "--interval", "10800"], monkeypatch)
|
||||
assert s.interval == 10800
|
||||
|
||||
|
||||
def test_example_toml_loads(monkeypatch):
|
||||
|
||||
Reference in new issue
Block a user