Documentation ¶
Index ¶
- Variables
- func AddDefaults(v *viper.Viper) error
- func AddFile(v *viper.Viper, file string) error
- func AddStandardFiles(v *viper.Viper) error
- func JSONSchema() *jsonschema.Schema
- func Unmarshal(v *viper.Viper, cfg *Config) error
- type ClientType
- type Config
- type Daemon
- type GRPC
- type Log
- type LogColor
- type LogFormat
- type LogLevel
- type Sqlite
Constants ¶
This section is empty.
Variables ¶
var Default = Config{ Sqlite: Sqlite{ Path: cfgpath.DataPath, Mkdir: true, }, Client: ClientTypeSqlite, GRPC: GRPC{ Address: "localhost:59122", }, Daemon: Daemon{ BindAddress: "localhost:59122", }, Log: Log{ Format: LogFormatPretty, Level: LogLevel(logger.LevelInfo), Color: LogColorAuto, }, // contains filtered or unexported fields }
Functions ¶
func AddDefaults ¶
func AddFile ¶
AddFile uses the Default configs and then merges the config from a specific file. The function will error if the file does not exist.
func AddStandardFiles ¶
AddStandardFiles uses the Default configs and then merges the config from first file it finds in the following list:
- /etc/dinkur/dinkur.yaml - ~/.config/dinkur.yaml - ~/.dinkur.yaml ~ .dinkur.yaml (current directory)
Where the first one found will be used.
func JSONSchema ¶
func JSONSchema() *jsonschema.Schema
JSONSchema returns the JSON schema struct for the Config struct.
Types ¶
type ClientType ¶
type ClientType string
const ( ClientTypeSqlite ClientType = "sqlite" ClientTypeGRPC ClientType = "grpc" )
func (ClientType) JSONSchema ¶
func (ClientType) JSONSchema() *jsonschema.Schema
JSONSchema returns the JSON schema struct for this struct.
func (*ClientType) Set ¶
func (f *ClientType) Set(value string) error
func (ClientType) String ¶
func (f ClientType) String() string
func (*ClientType) Type ¶
func (f *ClientType) Type() string
func (*ClientType) UnmarshalText ¶
func (f *ClientType) UnmarshalText(text []byte) error
type Config ¶
type Config struct { Client ClientType Sqlite Sqlite GRPC GRPC Daemon Daemon Log Log // contains filtered or unexported fields }
type Daemon ¶
type Daemon struct { // BindAddress defines which IP/hostname and port to serve the gRPC API on. // Can be set to 0.0.0.0 as IP to allow access from any IP. BindAddress string }
type GRPC ¶
type GRPC struct { // Address defines which IP/hostname and port to reach the API on. Address string }
type Log ¶
type Log struct { // Format defines how the logs are printed to the console, either "pretty" // for human readable, or "json" for machine readable. Format LogFormat // Level defines the logging severity level. All log messages below this // config will not be logged. Level LogLevel // Color defines if the log output should be colored. Defaults to "auto", // where it will only use colors if it detects interactive TTY, but // options "always" and "never" can override this. Color LogColor }
type LogColor ¶
type LogColor string
func (LogColor) JSONSchema ¶
func (LogColor) JSONSchema() *jsonschema.Schema
JSONSchema returns the JSON schema struct for this struct.
func (*LogColor) UnmarshalText ¶
type LogFormat ¶
type LogFormat string
func (LogFormat) JSONSchema ¶
func (LogFormat) JSONSchema() *jsonschema.Schema
JSONSchema returns the JSON schema struct for this struct.
func (*LogFormat) UnmarshalText ¶
type LogLevel ¶
func (LogLevel) JSONSchema ¶
func (LogLevel) JSONSchema() *jsonschema.Schema
JSONSchema returns the JSON schema struct for this struct.
func (LogLevel) MarshalText ¶
func (*LogLevel) UnmarshalText ¶
type Sqlite ¶
type Sqlite struct { // Path is the file path of where to store the sqlite database file, i.e // the file containing all the time-tracked entries. Path string // Mkdir will enable creating any missing directories for the data // directory, if set to true. Will fail if directories don't exist and // this is set to false. Mkdir bool }