config

package
v0.0.0-...-21cca52 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadConfig

func ReadConfig(configEnvVar, configFile, secretsFile string) error

Types

type AirtableBaseConfig

type AirtableBaseConfig struct {
	BaseID            string `json:"airtableBaseId"`
	AirtableTableName string
	InfluxMeasurement string
	Fields            AirtableFieldsConfig
}

type AirtableConfig

type AirtableConfig struct {
	UpdateFrequency  string               `json:"updateFrequency"`
	AirtableDatabase string               `json:"airtableDatabase"`
	AirtableBases    []AirtableBaseConfig `json:"airtableBases"`
}

func CurrentAirtableConfig

func CurrentAirtableConfig() *AirtableConfig

type AirtableFieldsConfig

type AirtableFieldsConfig struct {
	ConvertToTimeFromMidnightList []string
	ConvertBoolToInt              bool
	Blacklist                     []string
}

type AirtableSecrets

type AirtableSecrets struct {
	AirtableAPIKey string `json:"airtableApiKey"`
}

func CurrentAirtableSecrets

func CurrentAirtableSecrets() *AirtableSecrets

type Budget

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
}

type CalculatedField

type CalculatedField struct {
	Name          string
	Category      []string
	CategoryGroup []string
	Payee         []string
	Inverted      bool
}

type Config

type Config struct {
	Ynab     YnabConfig
	Airtable AirtableConfig
}

func CurrentConfig

func CurrentConfig() *Config

type CurrencyConversion

type CurrencyConversion map[string]float64

type ExchangerateAPISecrets

type ExchangerateAPISecrets struct {
	AccessKey string `json:"accessKey" env:"EXCHANGE_RATES_API_ACCESS_KEY"`
}

func CurrentExchangeRateAPISecrets

func CurrentExchangeRateAPISecrets() *ExchangerateAPISecrets

type InfluxSecrets

type InfluxSecrets struct {
	InfluxEndpoint string
	InfluxUsername string
	InfluxPassword string
}

func CurrentInfluxSecrets

func CurrentInfluxSecrets() *InfluxSecrets

type Secrets

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"`
}

func CurrentSecrets

func CurrentSecrets() *Secrets

type SqlSecrets

type SqlSecrets struct {
	SqlHost     string `env:"SQL_HOST"`
	SqlUsername string `env:"SQL_USERNAME"`
	SqlPassword string `env:"SQL_PASSWORD"`
}

func CurrentSqlSecrets

func CurrentSqlSecrets() *SqlSecrets

type YnabConfig

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
	}
}

func CurrentYnabConfig

func CurrentYnabConfig() *YnabConfig

type YnabSecrets

type YnabSecrets struct {
	YnabAccessToken string `json:"ynabAccessToken" env:"YNAB_ACCESS_TOKEN"`
}

func CurrentYnabSecrets

func CurrentYnabSecrets() *YnabSecrets

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL