-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
108 lines (91 loc) · 2.83 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package config
type Config struct {
Ynab YnabConfig
Airtable AirtableConfig
}
type Secrets struct {
Ynab YnabSecrets
Airtable AirtableSecrets
Influx InfluxSecrets
SQL SqlSecrets
ExchangerateAPI ExchangerateAPISecrets `json:"exchangeratesapi"`
// Altternative to Sql struct, also specifies table name which will be used for all importer
// designed to be used with heroku env variable
DatabaseURL string `env:"DATABASE_URL"`
}
///////////////////////////////////////////////////////////////////////////////////////
// YNAB
///////////////////////////////////////////////////////////////////////////////////////
type YnabConfig struct {
UpdateFrequency string
Currencies []string
Budgets []Budget
SQL struct {
YnabDatabase string
TransactionsTable string
AccountsTable string
BudgetsTable string
NetworthTable string
BatchSize int
}
Tags struct {
Enabled bool
RegexMatch string
}
}
type Budget struct {
Name string `json:"name"`
// Date to import transactions after
ImportAfterDate string `json:"importAfterDate"`
ID string `json:"id"`
Currency string `json:"currency"`
Conversions CurrencyConversion `json:"conversions"`
CalculatedFields []CalculatedField
// CalculatedFields []financialimporter.CalculatedField
}
type CalculatedField struct {
Name string
Category []string
CategoryGroup []string
Payee []string
Inverted bool
}
type CurrencyConversion map[string]float64
type YnabSecrets struct {
YnabAccessToken string `json:"ynabAccessToken" env:"YNAB_ACCESS_TOKEN"`
}
type InfluxSecrets struct {
InfluxEndpoint string
InfluxUsername string
InfluxPassword string
}
type SqlSecrets struct {
SqlHost string `env:"SQL_HOST"`
SqlUsername string `env:"SQL_USERNAME"`
SqlPassword string `env:"SQL_PASSWORD"`
}
type ExchangerateAPISecrets struct {
AccessKey string `json:"accessKey" env:"EXCHANGE_RATES_API_ACCESS_KEY"`
}
///////////////////////////////////////////////////////////////////////////////////////
// Airtable
///////////////////////////////////////////////////////////////////////////////////////
type AirtableConfig struct {
UpdateFrequency string `json:"updateFrequency"`
AirtableDatabase string `json:"airtableDatabase"`
AirtableBases []AirtableBaseConfig `json:"airtableBases"`
}
type AirtableBaseConfig struct {
BaseID string `json:"airtableBaseId"`
AirtableTableName string
InfluxMeasurement string
Fields AirtableFieldsConfig
}
type AirtableFieldsConfig struct {
ConvertToTimeFromMidnightList []string
ConvertBoolToInt bool
Blacklist []string
}
type AirtableSecrets struct {
AirtableAPIKey string `json:"airtableApiKey"`
}