config

package
v0.0.0-...-ae87ca3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Settings Settings
	Database Database
	Remotes  map[string]Remote
}

func InitConfig

func InitConfig(configPaths ...string) (*Config, error)

type Database

type Database struct {
	Engine string `validate:"required,oneof=sqlite3"`
	Path   string `validate:"required"`
}

type Remote

type Remote interface {
	Type() string // TODO: change to specific preset type RemoteType
	String() string
}

type Settings

type Settings struct {
	Editor        string
	Currency      string   `mapstructure:"default_currency"`
	DefaultRemote string   `mapstructure:"default_remote"`
	DefaultClient string   `mapstructure:"default_client"` // TODO: this might be better as a databased setting
	AutoSync      []string `mapstructure:"autosync" validate:"omitempty,dive,oneof=start end edit delete"`
}

type SpreadsheetRemote

type SpreadsheetRemote struct {
	ID                     string `mapstructure:"spreadsheet_id" validate:"required"`
	SheetName              string `mapstructure:"sheet_name" validate:"required"`
	ServiceAccountJsonPath string `mapstructure:"service_account_json_path"`
	Columns                struct {
		ID        string `validate:"required"`
		Client    string `validate:"required"`
		Date      string `validate:"required"`
		StartTime string `mapstructure:"start_time" validate:"required"`
		EndTime   string `mapstructure:"end_time" validate:"required"`
		TotalTime string `mapstructure:"total_time" validate:"required"`
		Note      string `validate:"required"` // TODO: make this optional
	} `validate:"required"`
}

func (*SpreadsheetRemote) String

func (s *SpreadsheetRemote) String() string

func (*SpreadsheetRemote) Type

func (s *SpreadsheetRemote) Type() string

Jump to

Keyboard shortcuts

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