Documentation
¶
Index ¶
Constants ¶
View Source
const Version = "0.7.1"
Variables ¶
This section is empty.
Functions ¶
func PrintVersionInfoAndExit ¶
func PrintVersionInfoAndExit()
Types ¶
type Config ¶
type Config struct {
App ConfigApp `yaml:"app"`
// Log specifies logging related configurations.
Log ConfigLog `yaml:"log"`
// Debounce is the file watcher debounce duration.
Debounce struct {
// Templ is the browser tab reload debounce duration
// for _templ.txt changes.
Templ time.Duration `yaml:"templ"`
// Go is the Go recompilation debounce duration.
Go time.Duration `yaml:"go"`
} `yaml:"debounce"`
// ProxyTimeout defines for how long the proxy must try retry
// requesting the application server when receiving connection refused error.
ProxyTimeout time.Duration `yaml:"proxy-timeout"`
// Lint runs golangci-lint before building if enabled.
Lint bool `yaml:"lint"`
// TemplierHost is the Templiér HTTP server host address.
// Example: "127.0.0.1:9999".
TemplierHost string `yaml:"templier-host" validate:"url,required"`
// TLS is optional, will serve HTTP instead of HTTPS if nil.
TLS *struct {
Cert string `yaml:"cert" validate:"filepath,required"`
Key string `yaml:"key" validate:"filepath,required"`
} `yaml:"tls"`
// CustomWatchers defines custom file change watchers.
CustomWatchers []ConfigCustomWatcher `yaml:"custom-watchers"`
// contains filtered or unexported fields
}
func (*Config) ServerOutPath ¶
type ConfigApp ¶
type ConfigApp struct {
// DirSrcRoot is the source root directory for the application server.
DirSrcRoot string `yaml:"dir-src-root" validate:"dirpath,required"`
// Exclude defines glob expressions to match files exluded from watching.
Exclude GlobList `yaml:"exclude"`
// DirCmd is the server cmd directory containing the `main` function.
DirCmd string `yaml:"dir-cmd" validate:"dirpath,required"`
// DirWork is the working directory to run the application server from.
DirWork string `yaml:"dir-work" validate:"dirpath,required"`
Environment map[string]string `yaml:"environment"`
// GoFlags are the CLI arguments to be passed to the go compiler when
// compiling the application server.
GoFlags SpaceSeparatedList `yaml:"go-flags"`
// Flags are the CLI arguments to be passed to the application server.
Flags SpaceSeparatedList `yaml:"flags"`
// Host is the application server host address.
// Example: "https://local.example.com:8080"
Host URL `yaml:"host" validate:"required"`
// contains filtered or unexported fields
}
func (*ConfigApp) DirSrcRootAbsolute ¶
type ConfigCustomWatcher ¶
type ConfigCustomWatcher struct {
// Name is the display name for the custom watcher.
Name string `yaml:"name"`
// Include specifies glob expressions for what files to watch.
Include GlobList `yaml:"include"`
// Exclude specifies glob expressions for what files to ignore
// that would otherwise match `include`.
Exclude GlobList `yaml:"exclude"`
// Cmd specifies the command to run when an included file changed.
// Cmd will be executed in app.dir-work. This is optional and can be left empty
// since sometimes all you want to do is rebuild & restart or just restart
// the server, such as when a config file changes.
Cmd CmdStr `yaml:"cmd"`
// FailOnError specifies that in case cmd returns error code 1 the output
// of the execution should be displayed in the browser, just like
// for example if the Go compiler fails to compile.
FailOnError bool `yaml:"fail-on-error"`
// Debounce defines how long to wait for more file changes
// after the first one occured before executing cmd.
// Default debounce duration is applied if left empty.
Debounce time.Duration `yaml:"debounce"`
// Requires defines what action is required when an included file changed.
// Accepts the following options:
//
// - "" (or simply keep the field empty): no action, just execute Cmd.
// - "reload": Requires browser tabs to be reloaded.
// - "restart": Requires the server process to be restarted.
// - "rebuild": Requires the server to be rebuilt and restarted.
//
// This option overwrites regular behavior (for non-templ file changes it's "rebuild")
Requires Requires `yaml:"requires"`
}
func (ConfigCustomWatcher) Validate ¶
func (w ConfigCustomWatcher) Validate() error
type ConfigLog ¶
type ConfigLog struct {
// Level accepts either of:
// - "": empty string is the same as "erronly"
// - "erronly": error logs only.
// - "verbose": verbose logging of relevant events.
// - "debug": verbose debug logging.
Level LogLevel `yaml:"level"`
// ClearOn accepts either of:
// - "": disables console log clearing.
// - "restart": clears console logs only on app server restart.
// - "file-change": clears console logs on every file change.
ClearOn LogClear `yaml:"clear-on"`
// PrintJSDebugLogs enables Templiér injected javascript
// debug logs in the browser.
PrintJSDebugLogs bool `yaml:"print-js-debug-logs"`
}
type LogLevel ¶
func (*LogLevel) UnmarshalText ¶
type Requires ¶
func (*Requires) UnmarshalText ¶
type SpaceSeparatedList ¶
type SpaceSeparatedList []string
func (*SpaceSeparatedList) UnmarshalText ¶
func (l *SpaceSeparatedList) UnmarshalText(t []byte) error
Click to show internal directories.
Click to hide internal directories.