Skip to content

Commit

Permalink
Merge pull request #70 from martinohansen/martin/fix-69
Browse files Browse the repository at this point in the history
fix(Nordigen): bring back file override
  • Loading branch information
martinohansen authored Mar 11, 2024
2 parents b2d89b4 + bb5cc68 commit 7f8c6dd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
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://raw.githubusercontent.com/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

0 comments on commit 7f8c6dd

Please sign in to comment.