From b2a2c23cae84120e5d3799d3d5f622ff930aa643 Mon Sep 17 00:00:00 2001 From: Martin Hansen Date: Sat, 13 Jan 2024 14:05:03 +0100 Subject: [PATCH] fix(nordigen): add HTTP timeout Use forked Nordigen client with timeout to avoid hanging forever on connections go nowhere. Fixes #61 --- .gitignore | 1 + cmd/ynabber/main.go | 3 +++ go.mod | 6 ++++-- go.sum | 6 ++++-- reader/nordigen/auth.go | 2 +- reader/nordigen/mapper.go | 2 +- reader/nordigen/mapper_test.go | 2 +- reader/nordigen/nordigen.go | 2 +- reader/nordigen/nordigen_test.go | 2 +- 9 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 047ea49..aa40a70 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.csv *.env *.json +.cache diff --git a/cmd/ynabber/main.go b/cmd/ynabber/main.go index ae2c76a..91df627 100644 --- a/cmd/ynabber/main.go +++ b/cmd/ynabber/main.go @@ -7,6 +7,7 @@ import ( "strings" "time" + "github.com/carlmjohnson/versioninfo" "github.com/kelseyhightower/envconfig" "github.com/martinohansen/ynabber" "github.com/martinohansen/ynabber/reader/nordigen" @@ -15,6 +16,8 @@ import ( ) func main() { + log.Println("Version:", versioninfo.Short()) + // Read config from env var cfg ynabber.Config err := envconfig.Process("", &cfg) diff --git a/go.mod b/go.mod index 3c7428a..ed08942 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/martinohansen/ynabber go 1.21 -require github.com/frieser/nordigen-go-lib/v2 v2.1.4 - require github.com/kelseyhightower/envconfig v1.4.0 + +require github.com/carlmjohnson/versioninfo v0.22.5 + +require github.com/martinohansen/nordigen-go-lib/v2 v2.1.1-0.20240113131411-57fc6c590df0 diff --git a/go.sum b/go.sum index e4dfa52..2772292 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,6 @@ -github.com/frieser/nordigen-go-lib/v2 v2.1.4 h1:dg5uSCAONW7nPONcmzvMcqloj5I37gbMLk3YsEF3rMU= -github.com/frieser/nordigen-go-lib/v2 v2.1.4/go.mod h1:NejYisqD8GvynCN0vDGw7J66slnj7jB25c8tS1tr8bw= +github.com/carlmjohnson/versioninfo v0.22.5 h1:O00sjOLUAFxYQjlN/bzYTuZiS0y6fWDQjMRvwtKgwwc= +github.com/carlmjohnson/versioninfo v0.22.5/go.mod h1:QT9mph3wcVfISUKd0i9sZfVrPviHuSF+cUtLjm2WSf8= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= +github.com/martinohansen/nordigen-go-lib/v2 v2.1.1-0.20240113131411-57fc6c590df0 h1:pU+0ogcgVGwndZazPXyE7MVy6Kmco6Jfp4jK+HGgcWc= +github.com/martinohansen/nordigen-go-lib/v2 v2.1.1-0.20240113131411-57fc6c590df0/go.mod h1:hUd8YJRV7SyNGdPpv4JxR7HqF09gctMJqH0UOvvemtA= diff --git a/reader/nordigen/auth.go b/reader/nordigen/auth.go index 9df6a18..c8dc944 100644 --- a/reader/nordigen/auth.go +++ b/reader/nordigen/auth.go @@ -11,7 +11,7 @@ import ( "strconv" "time" - "github.com/frieser/nordigen-go-lib/v2" + "github.com/martinohansen/nordigen-go-lib/v2" ) const RequisitionRedirect = "https://raw.githubusercontent.com/martinohansen/ynabber/main/ok.html" diff --git a/reader/nordigen/mapper.go b/reader/nordigen/mapper.go index dcd04ab..5e5646a 100644 --- a/reader/nordigen/mapper.go +++ b/reader/nordigen/mapper.go @@ -5,7 +5,7 @@ import ( "strconv" "time" - "github.com/frieser/nordigen-go-lib/v2" + "github.com/martinohansen/nordigen-go-lib/v2" "github.com/martinohansen/ynabber" ) diff --git a/reader/nordigen/mapper_test.go b/reader/nordigen/mapper_test.go index f60de10..bbe19e3 100644 --- a/reader/nordigen/mapper_test.go +++ b/reader/nordigen/mapper_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/frieser/nordigen-go-lib/v2" + "github.com/martinohansen/nordigen-go-lib/v2" ) func TestParseAmount(t *testing.T) { diff --git a/reader/nordigen/nordigen.go b/reader/nordigen/nordigen.go index 7984bc6..8e7d4f7 100644 --- a/reader/nordigen/nordigen.go +++ b/reader/nordigen/nordigen.go @@ -6,7 +6,7 @@ import ( "regexp" "strings" - "github.com/frieser/nordigen-go-lib/v2" + "github.com/martinohansen/nordigen-go-lib/v2" "github.com/martinohansen/ynabber" ) diff --git a/reader/nordigen/nordigen_test.go b/reader/nordigen/nordigen_test.go index 15c6fc1..a442bf3 100644 --- a/reader/nordigen/nordigen_test.go +++ b/reader/nordigen/nordigen_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/frieser/nordigen-go-lib/v2" "github.com/kelseyhightower/envconfig" + "github.com/martinohansen/nordigen-go-lib/v2" "github.com/martinohansen/ynabber" )