Documentation
¶
Overview ¶
Any configuration of taskninja belongs here
Index ¶
Constants ¶
const DefaultLogPath = "/tmp/taskninja.log"
Variables ¶
This section is empty.
Functions ¶
func GetConfig ¶
func GetConfig() (*Config, *ConfigError)
Used to load the configuration from the config file
Types ¶
type Config ¶
type Config struct { Connection SqlConnectionConfig `yaml:"connection"` // How to connect to the sqlite database Log Log `yaml:"log"` // How to log }
Contains the user configuration
func Bootstrap ¶
func Bootstrap() *Config
Bootstrap creates the initial configuration file if it does not exist
func (*Config) InitLogger ¶
func (c *Config) InitLogger()
InitLogger initializes the logger, sets up the handlers, levels, etc.
type ConfigError ¶
type ConfigError struct { Variant ConfigErrorVariant // The type of error Err error // The error that occurred }
ConfigError is an error that occurs when loading the configuration
func (ConfigError) CanBootstrap ¶
func (e ConfigError) CanBootstrap() bool
CanBootstrap returns true if the error can be resolved by bootstrapping the configuration
type ConfigErrorVariant ¶
type ConfigErrorVariant string
const ( ConfigErrorNoHomeDir ConfigErrorVariant = "no-home-dir" // User home directory not found ConfigErrorFileNotFound ConfigErrorVariant = "file-not-found" // Config file not found ConfigErrorConfigDirDoesNotExist ConfigErrorVariant = "config-dir-does-not-exist" // Config directory does not exist ConfigErrorReadFile ConfigErrorVariant = "read-file" // Failed to read config file ConfigErrorUnmarshal ConfigErrorVariant = "unmarshal" // Failed to unmarshal config )
type ConnectionMode ¶
type ConnectionMode string
ConnectionMode is the type of connection to the sqlite database
const ( ConnectionModeInMemory ConnectionMode = "in-memory" // SQLITE in-memory database ConnectionModeFile ConnectionMode = "file" // SQLITE file database )
type SqlConnectionConfig ¶
type SqlConnectionConfig struct { Mode ConnectionMode `yaml:"mode"` // in-memory, file, http Path string `yaml:"connection"` // connection string BackupPath string `yaml:"backupPath"` // Location to backup the database (sqlite disk only) }
Contains the SQL connection configuration
func (*SqlConnectionConfig) DSN ¶
func (c *SqlConnectionConfig) DSN() string
DSN returns the data source name for the connection e.g "sqlite://:memory:", or "sqlite:///path/to/file.db", Defaults to in-memory if not set