Skip to content

Commit fc99cc5

Browse files
committed
Add AUTO_REFRESH environment variable
Change-type: minor Signed-off-by: Phil Wilson <[email protected]>
1 parent a410cbb commit fc99cc5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ The following environment variables allow configuration of the `browser` block:
9292
|`WINDOW_POSITION`|`x,y`|`0,0`|Specifies the browser window position on the screen|
9393
|`API_PORT`|port number|5011|Specifies the port number the API runs on|
9494
|`REMOTE_DEBUG_PORT`|port number|35173|Specifies the port number the chrome remote debugger runs on|
95+
|`AUTO_REFRESH`|interval|0 (disabled)|Specifies the number of seconds before the page automatically refreshes|
9596

9697
---
9798

src/server.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const REMOTE_DEBUG_PORT = process.env.REMOTE_DEBUG_PORT || 35173;
2222
const FLAGS = process.env.FLAGS || null;
2323
const EXTRA_FLAGS = process.env.EXTRA_FLAGS || null;
2424
const HTTPS_REGEX = /^https?:\/\//i //regex for HTTP/S prefix
25+
const AUTO_REFRESH = process.env.AUTO_REFRESH || 0;
2526

2627
// Environment variables which can be overriden from the API
2728
let kioskMode = process.env.KIOSK || '0';
@@ -182,6 +183,7 @@ async function SetDefaultFlags() {
182183
}
183184

184185
async function setTimer(interval) {
186+
console.log("Auto refresh interval: ", interval);
185187
timer = setIntervalAsync(
186188
async () => {
187189
try {
@@ -204,6 +206,10 @@ async function main(){
204206
await SetDefaultFlags();
205207
let url = await getUrlToDisplayAsync();
206208
await launchChromium(url);
209+
if (AUTO_REFRESH > 0)
210+
{
211+
await setTimer(AUTO_REFRESH * 1000);
212+
}
207213
}
208214

209215

0 commit comments

Comments
 (0)