Relative from and to date in config, changed default to 3 days
All checks were successful
Deploy application / deploy (push) Successful in 7s
All checks were successful
Deploy application / deploy (push) Successful in 7s
This commit is contained in:
15
config.ts
15
config.ts
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user