AdguardTeam / AdguardTeam/AdGuardHome

Use a uniform duration format in the configuration file?

Offen
#3,034 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement P4: Low
Vorherrschende Sprache
TypeScript
Sterne
36.9k
Forks
2.5k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Currently, we either have the time unit in the name of the field, like with `block_auth_min` and `dhcp.dhcpv4.icmp_timeout_msec` or don't have a unit at all, like with `dns.querylog_interval` or `web_session_ttl`. But Go has the `time.Duration` type, which has a well-known string serialisation format. Unfortunately, it doesn't implement the `encoding.TextMarshaler` and `encoding.TextUnmarshaler` interfaces, but that is relatively easy to fix. In return, we get more uniform an human-readable durations in our configuration file:

```yaml
# …
web_session_ttl: 30d
# …
dns:
# …
querylog_interval: 90d
# …
dhcp:
dhcpv4:
# …
icmp_timeout: 1s
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.