mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-25 05:08:46 +00:00
refactor: increase cache TTL for trusted origins in admin service
This commit is contained in:
@@ -117,7 +117,7 @@ export const getDokployUrl = async () => {
|
|||||||
return `http://${settings?.serverIp}:${process.env.PORT}`;
|
return `http://${settings?.serverIp}:${process.env.PORT}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const TRUSTED_ORIGINS_CACHE_TTL_MS = 60_000;
|
const TRUSTED_ORIGINS_CACHE_TTL_MS = 30 * 60_000;
|
||||||
let trustedOriginsCache: { data: string[]; expiresAt: number } | null = null;
|
let trustedOriginsCache: { data: string[]; expiresAt: number } | null = null;
|
||||||
|
|
||||||
export const getTrustedOrigins = async () => {
|
export const getTrustedOrigins = async () => {
|
||||||
@@ -132,7 +132,6 @@ export const getTrustedOrigins = async () => {
|
|||||||
|
|
||||||
if (IS_CLOUD) {
|
if (IS_CLOUD) {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
console.log("trustedOriginsCache", trustedOriginsCache?.data.length);
|
|
||||||
if (trustedOriginsCache && now < trustedOriginsCache.expiresAt) {
|
if (trustedOriginsCache && now < trustedOriginsCache.expiresAt) {
|
||||||
return trustedOriginsCache.data;
|
return trustedOriginsCache.data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user