config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDir = "ipfs-monitor"
	ConfigFile = "config.yml"
)

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(name string) (string, error)

CreateFile creates config file

Types

type Common

type Common struct {
	PositionSettings
	Bordered        bool
	Enabled         bool
	RefreshInterval int
	Title           string
}

Common Module configs

type Config

type Config struct {
	Monitor struct {
		Colors struct {
			Border struct {
				Focusable string `yaml:"focusable"`
				Focused   string `yaml:"focused"`
				Normal    string `yaml:"normal"`
			} `yaml:"border"`
			Background string `yaml:"background"`
			Text       string `yaml:"text"`
		} `yaml:"colors"`
		Grid struct {
			Columns    []int  `yaml:"columns"`
			Rows       []int  `yaml:"rows"`
			Background string `yaml:"background"`
			Border     bool   `yaml:"border"`
		} `yaml:"grid"`
		RefreshInterval int                      `yaml:"refreshInterval"`
		Widgets         map[string]WidgetConfigs `yaml:"widgets"`
	} `yaml:"monitor"`
}

Config is monitor generated yml config

func CreateOrLoadConfigFile

func CreateOrLoadConfigFile() *Config

CreateOrLoadConfigFile creates or loads config file from config directory

type PositionSettings

type PositionSettings struct {
	Top    int `yaml:"top"`
	Left   int `yaml:"left"`
	Height int `yaml:"height"`
	Width  int `yaml:"width"`
}

PositionSettings places a module in a grid

type Settings

type Settings struct {
	Common *Common
	URL    string
}

Settings is module settings

type WidgetConfigs

type WidgetConfigs struct {
	Enabled          bool             `yaml:"enabled"`
	PositionSettings PositionSettings `yaml:"position"`
	RefreshInterval  int              `yaml:"refreshInterval"`
	Title            string           `yaml:"title"`
}

WidgetConfigs is config for each widgets

Jump to

Keyboard shortcuts

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