Skip to content

Commit

Permalink
better env lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
jancajthaml committed Feb 20, 2021
1 parent ba2447f commit 456d2dd
Show file tree
Hide file tree
Showing 20 changed files with 436 additions and 550 deletions.
21 changes: 11 additions & 10 deletions services/bondster-bco-import/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package config

import (
"github.com/jancajthaml-openbank/bondster-bco-import/support/env"
"strings"
"time"
)
Expand Down Expand Up @@ -46,15 +47,15 @@ type Configuration struct {
// LoadConfig loads application configuration
func LoadConfig() Configuration {
return Configuration{
Tenant: envString("BONDSTER_BCO_TENANT", ""),
RootStorage: envString("BONDSTER_BCO_STORAGE", "/data") + "/t_" + envString("BONDSTER_BCO_TENANT", "") + "/import/bondster",
EncryptionKey: envSecret("BONDSTER_BCO_ENCRYPTION_KEY", nil),
BondsterGateway: envString("BONDSTER_BCO_BONDSTER_GATEWAY", "https://bondster.com/ib/proxy"),
LedgerGateway: envString("BONDSTER_BCO_LEDGER_GATEWAY", "https://127.0.0.1:4401"),
VaultGateway: envString("BONDSTER_BCO_VAULT_GATEWAY", "https://127.0.0.1:4400"),
LakeHostname: envString("BONDSTER_BCO_LAKE_HOSTNAME", "127.0.0.1"),
SyncRate: envDuration("BONDSTER_BCO_SYNC_RATE", 22*time.Second),
LogLevel: strings.ToUpper(envString("BONDSTER_BCO_LOG_LEVEL", "INFO")),
MetricsStastdEndpoint: envString("FIO_BCO_STATSD_ENDPOINT", "127.0.0.1:8125"),
Tenant: env.String("BONDSTER_BCO_TENANT", ""),
RootStorage: env.String("BONDSTER_BCO_STORAGE", "/data") + "/t_" + env.String("BONDSTER_BCO_TENANT", "") + "/import/bondster",
EncryptionKey: env.HexFile("BONDSTER_BCO_ENCRYPTION_KEY", nil),
BondsterGateway: env.String("BONDSTER_BCO_BONDSTER_GATEWAY", "https://bondster.com/ib/proxy"),
LedgerGateway: env.String("BONDSTER_BCO_LEDGER_GATEWAY", "https://127.0.0.1:4401"),
VaultGateway: env.String("BONDSTER_BCO_VAULT_GATEWAY", "https://127.0.0.1:4400"),
LakeHostname: env.String("BONDSTER_BCO_LAKE_HOSTNAME", "127.0.0.1"),
SyncRate: env.Duration("BONDSTER_BCO_SYNC_RATE", 22*time.Second),
LogLevel: strings.ToUpper(env.String("BONDSTER_BCO_LOG_LEVEL", "INFO")),
MetricsStastdEndpoint: env.String("FIO_BCO_STATSD_ENDPOINT", "127.0.0.1:8125"),
}
}
103 changes: 0 additions & 103 deletions services/bondster-bco-import/config/environment.go

This file was deleted.

147 changes: 0 additions & 147 deletions services/bondster-bco-import/config/environment_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion services/bondster-bco-import/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.15
require (
github.com/DataDog/datadog-go v4.4.0+incompatible
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/jancajthaml-openbank/actor-system v1.4.6
github.com/jancajthaml-openbank/actor-system v1.4.7
github.com/jancajthaml-openbank/local-fs v1.2.2
github.com/rs/zerolog v1.20.0
github.com/stretchr/testify v1.7.0
Expand Down
10 changes: 4 additions & 6 deletions services/bondster-bco-import/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ github.com/DataDog/datadog-go v4.4.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/jancajthaml-openbank/actor-system v1.4.6 h1:mo9DFiFW136tLG3oYRXGvEgwPmxvrDxmzQiWj3WpVq4=
github.com/jancajthaml-openbank/actor-system v1.4.6/go.mod h1:mLnN69sePtKknn+OL18hOM4N8f/llDIoia98eNzBkXo=
github.com/jancajthaml-openbank/actor-system v1.4.7 h1:sqO/7BTm47y/NQ29ZuWxgPU7d2CmIEH1pCrcKyN/7ck=
github.com/jancajthaml-openbank/actor-system v1.4.7/go.mod h1:KzC0k0aZLZyj+eKAyEByXqM2eKCCKmBlMcjo2TXLtYU=
github.com/jancajthaml-openbank/local-fs v1.2.2 h1:zBhEDRh2zY7VI1KHTMwp8uqxTP7XR9dB9cK0NYGnzmw=
github.com/jancajthaml-openbank/local-fs v1.2.2/go.mod h1:aeF1ybqH3QQsFvqGdvk/0+5TXnHk1T7R1l+ZQ5d8SkY=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pebbe/zmq4 v1.2.2 h1:RZ5Ogp0D5S6u+tSxopnI3afAf0ifWbvQOAw9HxXvZP4=
github.com/pebbe/zmq4 v1.2.2/go.mod h1:7N4y5R18zBiu3l0vajMUWQgZyjv464prE8RCyBcmnZM=
github.com/pebbe/zmq4 v1.2.3 h1:SwOjTnXrtwyq4Hs4AXghkrNNEMuMnpvCZfEGTkDgrgI=
github.com/pebbe/zmq4 v1.2.3/go.mod h1:7N4y5R18zBiu3l0vajMUWQgZyjv464prE8RCyBcmnZM=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -22,7 +21,6 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.20.0 h1:38k9hgtUBdxFwE34yS8rTHmHBa4eN16E4DJlv177LNs=
github.com/rs/zerolog v1.20.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
8 changes: 4 additions & 4 deletions services/bondster-bco-import/integration/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ func importTransactionsFromStatemets(
}

if statement.Direction == "CREDIT" {
credit.Name = "BONDSTER_"+statement.Amount.Currency + "_TYPE_NOSTRO"
debit.Name = "BONDSTER_"+statement.Amount.Currency + "_TYPE_" + statement.Type
credit.Name = "BONDSTER_" + statement.Amount.Currency + "_TYPE_NOSTRO"
debit.Name = "BONDSTER_" + statement.Amount.Currency + "_TYPE_" + statement.Type
} else {
credit.Name = "BONDSTER_"+statement.Amount.Currency + "_TYPE_" + statement.Type
debit.Name = "BONDSTER_"+statement.Amount.Currency + "_TYPE_NOSTRO"
credit.Name = "BONDSTER_" + statement.Amount.Currency + "_TYPE_" + statement.Type
debit.Name = "BONDSTER_" + statement.Amount.Currency + "_TYPE_NOSTRO"
}

request := model.Transaction{
Expand Down
8 changes: 3 additions & 5 deletions services/bondster-bco-import/persistence/path.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// Copyright (c) 2016-2021, Jan Cajthaml <jan.cajthaml@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,15 +14,14 @@

package persistence


func StatementPath(token string, currency string) string {
return "token/"+token+"/statements/"+currency
return "token/" + token + "/statements/" + currency
}

func StatementDataPath(token string, currency string, transfer string) string {
return "token/"+token+"/statements/"+currency+"/" + transfer + "/data"
return "token/" + token + "/statements/" + currency + "/" + transfer + "/data"
}

func StatementDoneMarkPath(token string, currency string, transfer string) string {
return "token/"+token+"/statements/"+currency+"/" + transfer + "/done"
return "token/" + token + "/statements/" + currency + "/" + transfer + "/done"
}

0 comments on commit 456d2dd

Please sign in to comment.