All checks were successful
Deploy to K8s / deploy (push) Successful in 24s
Add second Fio account (CZ0820100000002502035405 / 2502035405/2010). Both accounts are fetched on every sync run and combined before dedup, so the payments sheet accumulates transactions from either account. QR codes now default to the new account. Go: - config.go: hardcoded Accounts/LoadedAccount slice replaces scalar BankAccount + FioAPIToken; Config.BankAccount renamed QRAccount; per-account tokens via FIO_API_TOKEN_NEW / FIO_API_TOKEN_OLD - banksync.SyncToSheets: accepts []fio.Client, loops to combine txns - cmd/fuj/main.go: buildFioClients helper; both sync call sites updated - html_handler + build_adults/juniors: use Config.QRAccount - New TestSyncToSheets_MultiAccount covers cross-account dedup Python: - config.py: ACCOUNTS list + LOADED_ACCOUNTS (tokens from env) - fio_utils.py: fetch_transactions_for (per-account) + fetch_transactions_all (loops all accounts) - sync_fio_to_sheets.py: uses fetch_transactions_all Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
50 lines
1.8 KiB
Python
50 lines
1.8 KiB
Python
"""Centralized configuration for FUJ management scripts.
|
|
|
|
External service IDs, credentials, and tunable parameters.
|
|
Domain-specific constants (fees, column indices) stay in their respective modules.
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
# Paths
|
|
PROJECT_ROOT = Path(__file__).parent.parent
|
|
CREDENTIALS_PATH = Path(os.environ.get(
|
|
"CREDENTIALS_PATH",
|
|
str(PROJECT_ROOT / ".secret" / "fuj-management-bot-credentials.json"),
|
|
))
|
|
|
|
# Google Sheets IDs
|
|
ATTENDANCE_SHEET_ID = "1E2e_gT_K5AwSRCDLDTa2UetZTkHmBOcz0kFbBUNUNBA"
|
|
PAYMENTS_SHEET_ID = "1Om0YPoDVCH5cV8BrNz5LG5eR5MMU05ypQC7UMN1xn_Y"
|
|
|
|
# Attendance sheet tab GIDs
|
|
JUNIOR_SHEET_GID = "1213318614"
|
|
|
|
# Bank accounts — hardcoded list mirroring go/internal/config/config.go.
|
|
# The entry with primary=True is used for QR codes and as the BANK_ACCOUNT default.
|
|
ACCOUNTS = [
|
|
{"iban": "CZ0820100000002502035405", "acct_num": "2502035405", "token_env": "FIO_API_TOKEN_NEW", "primary": True},
|
|
{"iban": "CZ8520100000002800359168", "acct_num": "2800359168", "token_env": "FIO_API_TOKEN_OLD", "primary": False},
|
|
]
|
|
# Resolve API tokens from the environment once at import time.
|
|
LOADED_ACCOUNTS = [
|
|
{**a, "token": os.environ.get(a["token_env"], "")}
|
|
for a in ACCOUNTS
|
|
]
|
|
BANK_ACCOUNT = next(a["iban"] for a in ACCOUNTS if a["primary"])
|
|
|
|
# Cache settings
|
|
CACHE_DIR = PROJECT_ROOT / "tmp"
|
|
DRIVE_TIMEOUT = 10 # seconds
|
|
CACHE_TTL_SECONDS = int(os.environ.get("CACHE_TTL_SECONDS", 300)) # 5 min default
|
|
CACHE_API_CHECK_TTL_SECONDS = int(os.environ.get("CACHE_API_CHECK_TTL_SECONDS", 300)) # 5 min default
|
|
|
|
# Maps cache keys to their source sheet IDs (used by cache_utils)
|
|
CACHE_SHEET_MAP = {
|
|
"attendance_regular": ATTENDANCE_SHEET_ID,
|
|
"attendance_juniors": ATTENDANCE_SHEET_ID,
|
|
"exceptions_dict": PAYMENTS_SHEET_ID,
|
|
"payments_transactions": PAYMENTS_SHEET_ID,
|
|
}
|