config

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindConfigFile added in v1.0.2

func FindConfigFile(configPath string) (string, error)

FindConfigFile tries to find a config file in multiple locations

func GetDefaultConfigPath

func GetDefaultConfigPath() string

GetDefaultConfigPath returns the default config path for Linux and other Unix-like systems

Types

type AdminConfig

type AdminConfig struct {
	Host string `json:"host,omitempty" yaml:"host,omitempty"`
	Port int    `json:"port,omitempty" yaml:"port,omitempty"`
	Sock string `json:"sock,omitempty" yaml:"sock,omitempty"`
}

AdminConfig defines the HTTP admin interface configuration

type Config

type Config struct {
	Restart  string             `json:"restart,omitempty" yaml:"restart,omitempty"`
	Grace    string             `json:"grace,omitempty" yaml:"grace,omitempty"`
	Admin    interface{}        `json:"admin,omitempty" yaml:"admin,omitempty"`
	Services map[string]Process `json:"services" yaml:"services"`
}

Config defines the main application configuration

func LoadConfig

func LoadConfig(configPath string) (*Config, error)

LoadConfig loads the configuration from a file

func NormalizeConfig

func NormalizeConfig(config *Config) *Config

NormalizeConfig creates a copy of the config with all inherited values explicitly set

type Process

type Process struct {
	Cmd      interface{}       `json:"cmd" yaml:"cmd"`
	Cwd      string            `json:"cwd,omitempty" yaml:"cwd,omitempty"`
	Env      map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	Grace    string            `json:"grace,omitempty" yaml:"grace,omitempty"`
	Optional bool              `json:"optional,omitempty" yaml:"optional,omitempty"`
	Conflict interface{}       `json:"conflict,omitempty" yaml:"conflict,omitempty"`
	Restart  interface{}       `json:"restart,omitempty" yaml:"restart,omitempty"`
	Cron     string            `json:"cron,omitempty" yaml:"cron,omitempty"`
	Single   bool              `json:"single,omitempty" yaml:"single,omitempty"`
}

Process defines a service process configuration

type RestartPolicy

type RestartPolicy struct {
	Mode        string `json:"mode" yaml:"mode"`
	Base        string `json:"base,omitempty" yaml:"base,omitempty"`
	Exponential bool   `json:"exponential,omitempty" yaml:"exponential,omitempty"`
	Max         string `json:"max,omitempty" yaml:"max,omitempty"`
	MaxRetries  int    `json:"maxRetries,omitempty" yaml:"maxRetries,omitempty"`
}

RestartPolicy defines how a process should be restarted

Jump to

Keyboard shortcuts

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