Skip to content

Add TINYCARE_REFRESH_INTERVAL environment variable to control refresh timing#15

Merged
DMcP89 merged 2 commits intomainfrom
copilot/control-refresh-timer-variable
Nov 5, 2025
Merged

Add TINYCARE_REFRESH_INTERVAL environment variable to control refresh timing#15
DMcP89 merged 2 commits intomainfrom
copilot/control-refresh-timer-variable

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

The refresh interval was hardcoded to 300 seconds. This adds TINYCARE_REFRESH_INTERVAL to make it configurable.

Changes

  • New GetRefreshInterval() function: Reads TINYCARE_REFRESH_INTERVAL env var, parses as seconds, validates positive integer, defaults to 300
  • Updated refresh goroutine: Replaced hardcoded 300 * time.Second with GetRefreshInterval() call
  • Documentation: Added env var to README configuration section
  • Tests: Added unit tests covering default, valid, and invalid input cases

Usage

# Default 5 minutes
tinycare-tui

# Custom 60 seconds
TINYCARE_REFRESH_INTERVAL=60 tinycare-tui

# Invalid values fall back to default
TINYCARE_REFRESH_INTERVAL=0 tinycare-tui        # Uses 300s
TINYCARE_REFRESH_INTERVAL=invalid tinycare-tui  # Uses 300s
Original prompt

This section details on the original issue you should resolve

<issue_title>Control refresh timer with environment variable </issue_title>
<issue_description># Problem
Currently the views are setup to refresh every 30 seconds. This 30 second time frame is hard coded. We would like to control this via an environment variable named TINYCARE_REFRESH_INTERVAL.

Solution

Update this line to use the environment variable instead of a hardcoded value

https://github.com/DMcP89/tinycare-tui/blob/main/cmd%2Ftinycare-tui%2Fmain.go#L130</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: DMcP89 <4146149+DMcP89@users.noreply.github.com>
Copilot AI changed the title [WIP] Update refresh timer to use environment variable Add TINYCARE_REFRESH_INTERVAL environment variable to control refresh timing Nov 1, 2025
Copilot AI requested a review from DMcP89 November 1, 2025 14:28
@DMcP89 DMcP89 marked this pull request as ready for review November 5, 2025 20:36
@DMcP89 DMcP89 merged commit 1738296 into main Nov 5, 2025
1 check passed
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.

Control refresh timer with environment variable

2 participants