config

package
v0.0.0-...-56ccd80 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(ctx Context, cfg Global) error

Save updaets the accounts in the configuration file.

Types

type Account

type Account struct {
	// Name is the human-readable name of the account.
	Name string `json:"name"`

	// Calendars is the list of calendars to pull from the account.
	Calendars []Calendar `json:"calendars"`

	// Credentials is credentials JSON file downloaded from Google.
	Credentials map[string]interface{} `json:"credentials"`
}

Account configures a google account.

func (Account) MarshalEasyJSON

func (v Account) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Account) MarshalJSON

func (v Account) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Account) UnmarshalEasyJSON

func (v *Account) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Account) UnmarshalJSON

func (v *Account) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Calendar

type Calendar struct {
	// Name is the name of the calendar in Google.
	// Likely an email address.
	Name string `json:"name"`

	// Path is the path to org file to store calendar data.
	Path string `json:"path"`
}

Calendar configures a google calendar.

func (Calendar) MarshalEasyJSON

func (v Calendar) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Calendar) MarshalJSON

func (v Calendar) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Calendar) UnmarshalEasyJSON

func (v *Calendar) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Calendar) UnmarshalJSON

func (v *Calendar) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Context

type Context interface {
	libcontext.Context

	// FS returns the underlying filesystem to read/write from.
	FS() afero.Fs

	// Config returns the entire configuration as a struct.
	Config() Global

	// Accounts are all of the calendar accounts to sync.
	Accounts() []Account

	// CalendarDir is the path to the base directory to store calendars in.
	CalendarDir() string

	// TokenDir is the path to store account tokens
	TokenDir() string
}

Context represents all the values stored in the configuration.

func NewContext

func NewContext() Context

NewContext returns a new configuration context.

type Global

type Global struct {
	// Accounts are all of the calendar accounts to sync.
	Accounts []Account `yaml:"accounts"`

	// CalendarDir is the path to the base directory to store calendars in.
	CalendarDir string `mapstructure:"calendar_dir" yaml:"calendarDir"`

	// TokenDir is the path to store account tokens
	TokenDir string `mapstructure:"token_dir"`
}

Global is the configuration for the entire daemon.

func (Global) MarshalEasyJSON

func (v Global) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Global) MarshalJSON

func (v Global) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Global) UnmarshalEasyJSON

func (v *Global) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Global) UnmarshalJSON

func (v *Global) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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