config

package
v0.0.0-...-7644613 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupConfiguration

func SetupConfiguration(path string)

SetupConfiguration set configuration with path

Types

type Config

type Config struct {
	Port              int    `yaml:"port"`
	PprofPort         int    `yaml:"pprof_port"`
	ConfigurationPath string `yaml:"configuration_path"`
	LogFile           string `yaml:"log_file"`
	PidFile           string `yaml:"pid_file"`
	// contains filtered or unexported fields
}

Config configuration struct

var AppConfig *Config

func (*Config) GetAllProcesssConfig

func (conf *Config) GetAllProcesssConfig() []*ProcessConfig

GetAllProcesssConfig get all process config

type ProcessConfig

type ProcessConfig struct {
	Name             string  `yaml:"name"`
	Command          string  `yaml:"command"`            // process start command
	Environment      string  `yaml:"environment"`        // process start need env
	AutoStart        bool    `yaml:"auto_start"`         // if process can auto_start
	AutoRestart      bool    `yaml:"auto_restart"`       // if process can auto_restart
	User             string  `yaml:"user"`               // which user can to start the process
	Directory        *string `yaml:"directory"`          // process directory
	RetryTimes       *int    `yaml:"retry_times"`        // when start failed, retry start, try times
	StartSecs        *int    `yaml:"start_secs"`         // when start a process, then wait `start_secs` seconds to check if process is running
	RestartPause     *int    `yaml:"restart_pause_secs"` // when start failed, wait `secs` to restart again
	StopSignal       *string `yaml:"stop_signal"`        // stop signal default is TERM
	StdoutFile       *string `yaml:"stdout_file"`        // std_out
	StdoutMaxSize    int     `yaml:"stdout_max_size"`    // std_out max size, MegaByte rotate, default 100MB
	StdoutMaxBackups int     `yaml:"stdout_max_backups"` // number of logs to keep, default 10
	StderrFile       *string `yaml:"stderr_file"`        // std_err
	StderrMaxSize    int     `yaml:"stderr_max_size"`    // default 100MB
	StderrMaxBackups int     `yaml:"stderr_max_backups"` //
}

ProcessConfig process config

func ReadProcessConfigs

func ReadProcessConfigs(path string) (processConfigs []*ProcessConfig)

ReadProcessConfigs read all process configs

Jump to

Keyboard shortcuts

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