procfile

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2017 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	REGEXP_V1_LINE     = `^([A-z\d_]+):\s*(.+)`
	REGEXP_V2_VERSION  = `(?m)^\s*version:\s*2\s*$`
	REGEXP_PATH_CHECK  = `\A[A-Za-z0-9_\-./]+\z`
	REGEXP_VALUE_CHECK = `\A[A-Za-z0-9_\-]+\z`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Name        string     // Name of application
	Services    []*Service // List of services in application
	User        string     // Working user
	Group       string     // Working group
	StartLevel  int        // Start level
	StopLevel   int        // Stop level
	WorkingDir  string     // Working directory
	ProcVersion int        // Proc version 1/2
}

func Read

func Read(path string, config *Config) (*Application, error)

Read reads and parse procfile content

func (*Application) Validate

func (a *Application) Validate() []error

Validate validate all services in application

type Config

type Config struct {
	Name             string // Application name
	User             string // Working user
	Group            string // Working group
	WorkingDir       string // Working directory
	IsRespawnEnabled bool   // Global respawn enabled flag
	RespawnInterval  int    // Global respawn interval in seconds
	RespawnCount     int    // Global respawn count
	KillTimeout      int    // Global kill timeout in seconds
	LimitProc        int    // Global processes limit
	LimitFile        int    // Global descriptors limit
}

type Service

type Service struct {
	Name        string          // Service name
	Cmd         string          // Command
	PreCmd      string          // Pre command
	PostCmd     string          // Post command
	Options     *ServiceOptions // Service options
	Application *Application    // Pointer to parent application
	HelperPath  string          // Path to helper (will be set by exporter)
}

func (*Service) GetCommandExec added in v0.9.0

func (s *Service) GetCommandExec(command string) string

GetCommandExec return full command exec

func (*Service) GetCommandExecWithEnv added in v0.9.0

func (s *Service) GetCommandExecWithEnv(command string) string

GetCommandExecWithEnv return full command exec with env vars setting

func (*Service) HasPostCmd added in v0.9.0

func (s *Service) HasPostCmd() bool

HasPostCmd return true if post command is defined

func (*Service) HasPreCmd added in v0.9.0

func (s *Service) HasPreCmd() bool

HasPreCmd return true if pre command is defined

func (*Service) Validate

func (s *Service) Validate() []error

Validate validate service props and options

type ServiceOptions

type ServiceOptions struct {
	Env              map[string]string // Environment variables
	EnvFile          string            // Path to file with environment variables
	WorkingDir       string            // Working directory
	LogFile          string            // Path to log file
	KillTimeout      int               // Kill timeout in seconds
	KillSignal       string            // Kill signal name
	ReloadSignal     string            // Reload signal name
	Count            int               // Exec count
	RespawnInterval  int               // Respawn interval in seconds
	RespawnCount     int               // Respawn count
	IsRespawnEnabled bool              // Respawn enabled flag
	LimitProc        int               // Processes limit
	LimitFile        int               // Descriptors limit
}

func (*ServiceOptions) EnvString

func (so *ServiceOptions) EnvString() string

EnvString return environment variables as string

func (*ServiceOptions) FullEnvFilePath added in v0.11.0

func (so *ServiceOptions) FullEnvFilePath() string

FullEnvFilePath return absolute path to file with env vars

func (*ServiceOptions) FullLogPath added in v0.7.1

func (so *ServiceOptions) FullLogPath() string

FullLogPath return absolute path to service log

func (*ServiceOptions) IsCustomLogEnabled

func (so *ServiceOptions) IsCustomLogEnabled() bool

IsCustomLogEnabled return true if service have custom log

func (*ServiceOptions) IsEnvFileSet added in v0.11.0

func (so *ServiceOptions) IsEnvFileSet() bool

IsEnvFileSet return true if service have file with env vars

func (*ServiceOptions) IsEnvSet

func (so *ServiceOptions) IsEnvSet() bool

IsEnvSet return true if service have custom env vars

func (*ServiceOptions) IsFileLimitSet

func (so *ServiceOptions) IsFileLimitSet() bool

IsFileLimitSet return true if descriptors limit is set

func (*ServiceOptions) IsKillSignalSet added in v0.10.0

func (so *ServiceOptions) IsKillSignalSet() bool

IsKillSignalSet return true if custom kill signal set

func (*ServiceOptions) IsProcLimitSet

func (so *ServiceOptions) IsProcLimitSet() bool

IsProcLimitSet return true if processes limit is set

func (*ServiceOptions) IsReloadSignalSet added in v0.10.0

func (so *ServiceOptions) IsReloadSignalSet() bool

IsReloadSignalSet return true if custom reload signal set

func (*ServiceOptions) IsRespawnLimitSet

func (so *ServiceOptions) IsRespawnLimitSet() bool

IsRespawnLimitSet return true if respawn options is set

func (*ServiceOptions) Validate

func (so *ServiceOptions) Validate() []error

Validate validate service options

Jump to

Keyboard shortcuts

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