config

package
v0.0.0-...-369604a Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2016 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMatch

func IsMatch(c *Config, path string) bool

IsMatch checks whether an event on the given path should cause a reload.

func SetupWatcher

func SetupWatcher(c *Config) (*fsnotify.Watcher, error)

SetupWatcher sets up fsnotify to watch all the directories specified in the config.

Types

type Config

type Config struct {
	// BaseDir is the base directory where configs are based.
	// If this is not specified, the config file's location is used by default.
	BaseDir string `yaml:"baseDir"`

	// Matchers is the list of configurations to match.
	// If none are specified, it defaults to looking in baseDir for any changes.
	Matchers []Matcher `yaml:"matchers"`

	// ProxyConfigs is the list of ports that the file watcher listens on and forwards.
	ProxyConfigs []proxy.Config `yaml:"proxy"`

	// Action is the command to run to compile + restart the server.
	Action []string `yaml:"action"`

	// StdOut is the file that the task's STDOUT is written to.
	StdOut string `yaml:"outFile"`

	// StdErr is the file that the task's STDERR is written to.
	StdErr string `yaml:"errFile"`

	// Timeout configurations
	ChangeTimeout time.Duration `yaml:"changeTimeout"`
	KillTimeout   time.Duration `yaml:"killTimeout"`
	// contains filtered or unexported fields
}

Config is the struct defining the config file passed in to the file watcher.

func Parse

func Parse() (*Config, error)

Parse returns a configuration from either a configuration file or flags.

type Matcher

type Matcher struct {
	Patterns []string `yaml:"patterns"`
	Dirs     []string `yaml:"dirs"`

	// ExcludeDir is the name of directories that are excluded from the watcher.
	// By default, everything in defaultExcludeDirMap is excluded.
	ExcludeDirs []string `yaml:"excludeDirs"`
	// contains filtered or unexported fields
}

Matcher represents a specific set of patterns for some directories.

Jump to

Keyboard shortcuts

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