From 382d8b34ecf9dc4caf88ed25ad88784845c76ae3 Mon Sep 17 00:00:00 2001 From: Kamil Date: Mon, 25 Mar 2024 08:54:07 +0100 Subject: [PATCH] #270 - configurable refresh time --- .env.example | 3 +++ environment/prod/app/Dockerfile | 1 + environment/prod/app/vite.env | 1 + resources/js/Shared/LastUpdate.vue | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 environment/prod/app/vite.env diff --git a/.env.example b/.env.example index 71b86cde..3befff9c 100644 --- a/.env.example +++ b/.env.example @@ -67,3 +67,6 @@ SANCTUM_STATEFUL_DOMAINS=toby.blumilk.localhost SOPS_AGE_BETA_SECRET_KEY= SOPS_AGE_PROD_SECRET_KEY= + +# 5 minutes (in miliseconds) +VITE_LAST_UPDATE_TIMEOUT=300000 diff --git a/environment/prod/app/Dockerfile b/environment/prod/app/Dockerfile index 83e2c0b9..38a0d2e2 100644 --- a/environment/prod/app/Dockerfile +++ b/environment/prod/app/Dockerfile @@ -24,6 +24,7 @@ FROM node:21.6.2-bullseye-slim as frontend WORKDIR /app_frontend_dependencies COPY package.json package-lock.json postcss.config.js tailwind.config.js vite.config.js ./ +COPY ./environment/prod/app/vite.env .env RUN npm clean-install diff --git a/environment/prod/app/vite.env b/environment/prod/app/vite.env new file mode 100644 index 00000000..bd58f70c --- /dev/null +++ b/environment/prod/app/vite.env @@ -0,0 +1 @@ +VITE_LAST_UPDATE_TIMEOUT=300000 diff --git a/resources/js/Shared/LastUpdate.vue b/resources/js/Shared/LastUpdate.vue index 891bfa81..82377be0 100644 --- a/resources/js/Shared/LastUpdate.vue +++ b/resources/js/Shared/LastUpdate.vue @@ -23,6 +23,6 @@ const fetchLastUpdate = async () => { onMounted(() => { fetchLastUpdate() - setInterval(fetchLastUpdate, 300000) // 5 minutes + setInterval(fetchLastUpdate, import.meta.env.VITE_LAST_UPDATE_TIMEOUT) })