bootstrap

This commit is contained in:
kislovdm
2026-07-08 16:43:29 +03:00
parent 10b5eafd53
commit d2819ff03c
74 changed files with 8174 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
import NodeCache from 'node-cache'
import { config } from '../config.js'
const cache = new NodeCache({
stdTTL: config.trueApi.tokenTTL / 1000,
checkperiod: 600,
})
const TOKEN_KEY = 'true_api_token'
export function getToken(): string | undefined {
return cache.get<string>(TOKEN_KEY)
}
export function setToken(token: string): void {
cache.set(TOKEN_KEY, token)
}
export function hasToken(): boolean {
return cache.has(TOKEN_KEY)
}
export function getTokenTTL(): number | undefined {
return cache.getTtl(TOKEN_KEY)
}