Relative from and to date in config, changed default to 3 days
All checks were successful
Deploy application / deploy (push) Successful in 7s

This commit is contained in:
2025-01-31 16:58:02 +01:00
parent 752bdbceb4
commit 18a0fbfac8
5 changed files with 30 additions and 6 deletions

View File

@ -22,6 +22,16 @@ export const BANK_ACCOUNT_IDS = getArrayOrThrow("BANK_ACCOUNT_IDS")
export const DB_DIRECTORY = getOrDefault("DB_DIRECTORY", "data")
export const DB_FILENAME = getOrDefault("DB_FILENAME", "default")
export const LOG_LEVEL = getOrDefault("LOG_LEVEL", "info")
// Relative number of days in the past to start fetching transactions from
export const TRANSACTION_RELATIVE_FROM_DATE = getNumberOrDefault(
"TRANSACTION_RELATIVE_FROM_DATE",
4,
)
// Relative number of days in the past to end fetching transactions from
export const TRANSACTION_RELATIVE_TO_DATE = getNumberOrDefault(
"TRANSACTION_RELATIVE_TO_DATE",
3,
)
// Utility functions
function getOrDefault(key: string, def: string): string {
@ -37,3 +47,8 @@ function getOrThrow(key: string): string {
function getArrayOrThrow(key: string): ReadonlyArray<string> {
return getOrThrow(key).split(",")
}
function getNumberOrDefault(key: string, def: number): number {
const num = Number(process.env[key])
return Number.isNaN(num) ? def : num
}