nginx

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

The `nginx` task spawns an nginx server, and can test and reload the nginx configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExecAny

func IsExecAny(mode os.FileMode) bool

IsExecAny returns true if the file mode is executable by any user

func NewWithPlugin

func NewWithPlugin(p Plugin) (*t, error)

Create a new logger task with provider of other tasks

Types

type CallbackFn

type CallbackFn func(*Cmd, []byte)

Callback output from the command. Newlines are embedded within the string

type Cmd

type Cmd struct {
	*exec.Cmd
	Out, Err CallbackFn
}

func NewWithCommand

func NewWithCommand(cmd string, args ...string) (*Cmd, error)

Create a new logger task with provider of other tasks

func (*Cmd) Env

func (c *Cmd) Env(env map[string]string) error

Env appends the environment variables for the command

func (*Cmd) Exited

func (c *Cmd) Exited() bool

Return whether command has exited

func (*Cmd) Pid

func (c *Cmd) Pid() int

Return the pid of the process or 0

func (*Cmd) Run

func (c *Cmd) Run() error

Run the command in the foreground, and return any errors

func (*Cmd) Signal

func (c *Cmd) Signal(s os.Signal) error

Send signal to the process

func (*Cmd) String

func (t *Cmd) String() string

type Config

type Config struct {
	sync.RWMutex

	// Configuration Files
	Files map[string]*File
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(available, enabled string) (*Config, error)

func (*Config) Available

func (c *Config) Available() []string

Return a list of files which are available to be enabled

func (*Config) Enable

func (c *Config) Enable(key string, args ...any) error

func (*Config) String

func (c *Config) String() string

Return a list of files which are available to be enabled

type Event

type Event uint
const (
	EventStart Event = iota
	EventStop
	EventReload
	EventInfo
	EventError
)

func (Event) String

func (e Event) String() string

type File

type File struct {
	// Path to the file
	Path string

	// Info for the file
	Info fs.FileInfo

	// Enabled indicates the configuration file is enabled
	Enabled bool
}

func (*File) AvailableBase

func (f *File) AvailableBase() string

Return the "enabled" name of the file

func (*File) EnabledBase

func (f *File) EnabledBase() string

Return the "enabled" name of the file

func (*File) Ext

func (f *File) Ext() string

Return the file extension

func (*File) Hash

func (f *File) Hash() string

Return the hash of the filename

func (*File) Name

func (f *File) Name() string

Return the last element of the path by name

func (*File) String

func (f *File) String() string

type Plugin

type Plugin struct {
	task.Plugin
	Path_      types.String            `json:"path,omitempty"`      // Path to the nginx binary
	Config_    types.String            `json:"config,omitempty"`    // Path to the configuration file
	Prefix_    types.String            `json:"prefix,omitempty"`    // Prefix for nginx configuration
	Available_ types.String            `json:"available,omitempty"` // Path to available configurations
	Enabled_   types.String            `json:"enabled,omitempty"`   // Path to enabled configurations
	Env_       map[string]types.String `json:"env,omitempty"`       // Environment variable map
}

func (Plugin) Available

func (p Plugin) Available() string

func (Plugin) Config

func (p Plugin) Config() string

func (Plugin) Enabled

func (p Plugin) Enabled() string

func (Plugin) Env

func (p Plugin) Env() map[string]string

func (Plugin) Flags

func (p Plugin) Flags() []string

func (Plugin) Name

func (p Plugin) Name() string

func (Plugin) New

func (p Plugin) New(ctx context.Context, provider iface.Provider) (iface.Task, error)

Create a new logger task with provider of other tasks

func (Plugin) Path

func (p Plugin) Path() string

func (Plugin) Prefix

func (p Plugin) Prefix() string

Jump to

Keyboard shortcuts

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