Skip to content

feat(config): 時間指定 suffix フォーマット実装 — 1d, 5m, 1h, 30s (issue #46)#51

Merged
liplus-lin-lay merged 2 commits intomainfrom
issue-46-suffix-duration
Mar 5, 2026
Merged

feat(config): 時間指定 suffix フォーマット実装 — 1d, 5m, 1h, 30s (issue #46)#51
liplus-lin-lay merged 2 commits intomainfrom
issue-46-suffix-duration

Conversation

@liplus-lin-lay
Copy link
Copy Markdown
Collaborator

概要

issue #43(仕様書)§3.2 / issue #34(元 dipper 設定ファイル)対応。

変更内容

config.goparseDurationMinutes() 追加

入力 結果(分)
1d 1440
2h 120
5m 5
30s 1(切り上げ)
5(整数) 5(後方互換)
0 0(無効)

intMin / intGate がこの関数を使うようになり、
UPDATE_TIME, DDNS_TIME, IP_CACHE_TIME, ERR_CHK_TIME の全キーで suffix が使える。

scripts/install.shparse_duration_min() 追加

DDNS_TIME=5m のような suffix 形式を読んでタイマー間隔(分)に変換。

user.conf.example 更新

UPDATE_TIME=1d   # 1 day
DDNS_TIME=5m     # 5 minutes

Closes #46

liplus-lin-lay and others added 2 commits March 5, 2026 13:31
Add parseDurationMinutes() to config.go which accepts:
  30s → 1 min (rounded up)   5m → 5   2h → 120   1d → 1440
  plain integer → minutes (backward compatible)   0 → 0 (disabled)

intMin / intGate now delegate to parseDurationMinutes so all four
time-gate keys (UPDATE_TIME, DDNS_TIME, IP_CACHE_TIME, ERR_CHK_TIME)
accept the new format.

install.sh gains parse_duration_min() shell function to convert
DDNS_TIME suffix format before writing OnUnitActiveSec.

user.conf.example updated: UPDATE_TIME=1d, DDNS_TIME=5m with format
comment explaining s/m/h/d suffixes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Negative plain integers (e.g. DDNS_TIME=-5) were previously rejected as
invalid by parseDurationMinutes.  Return sentinel -1 instead so intMin /
intGate clamp them to the configured minimum, matching the behaviour of
UPDATE_TIME=0 (clamped to 3) and keeping consistency with the test
expectations in TestTimegateMinimum.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@liplus-lin-lay liplus-lin-lay merged commit fe70af7 into main Mar 5, 2026
4 checks passed
@liplus-lin-lay liplus-lin-lay deleted the issue-46-suffix-duration branch March 6, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(config): 時間指定に suffix フォーマットを実装 (1d, 5m, 1h, 30s)

1 participant