config

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppTasksConfig map[string]TaskConfig

Functions

func GetDefaultFileNameWithExtension

func GetDefaultFileNameWithExtension() string

func InitConfig

func InitConfig()

Types

type CheckFrequency

type CheckFrequency struct {
	Interval string `mapstructure:"interval"`
	Timeout  string `mapstructure:"timeout"`
	Tries    int    `mapstructure:"tries"`
	Delay    string `mapstructure:"delay"`
}

type CommandCheck

type CommandCheck struct {
	Scripts []string `mapstructure:"scripts"`
}

type HTTPCheck

type HTTPCheck struct {
	URL    string           `mapstructure:"url"`
	Expect *HttpCheckExpect `mapstructure:"expect"`
}

HTTPCheck 定義了 HTTP 健康檢查的配置

type HealthCheckConfig

type HealthCheckConfig struct {
	HTTP      *HTTPCheck      `mapstructure:"http"`
	Command   *CommandCheck   `mapstructure:"command"`
	Frequency *CheckFrequency `mapstructure:"frequency"`
}

HealthCheckConfig 定義了應用程式的健康檢查配置

type HttpCheckExpect

type HttpCheckExpect struct {
	Json  *HttpCheckExpectJson  `mapstructure:"json"`
	Plain *HttpCheckExpectPlain `mapstructure:"plain"`
}

type HttpCheckExpectJson

type HttpCheckExpectJson struct {
	Value    string `mapstructure:"value"`
	Jsonpath string `mapstructure:"jsonpath"`
}

type HttpCheckExpectPlain

type HttpCheckExpectPlain struct {
	Contains string `mapstructure:"contains"`
}

type LauncherConfig

type LauncherConfig struct {
	Tasks []TaskConfig `mapstructure:"tasks"`
}

LauncherConfig 定義了整個 dgrkt.yaml 的根配置

var AppConfig LauncherConfig

func (*LauncherConfig) Validate

func (lc *LauncherConfig) Validate() error

type TaskConfig

type TaskConfig struct {
	Name        string            `mapstructure:"name"`
	BaseDir     string            `mapstructure:"base_dir"`
	Envs        []string          `mapstructure:"envs"`
	Executable  string            `mapstructure:"executable"`
	Args        []string          `mapstructure:"args"`
	Healthcheck HealthCheckConfig `mapstructure:"healthcheck"`
	DependsOn   []string          `mapstructure:"depends_on"`
}

TaskConfig 定義了單個應用程式的配置

type TaskConfigCheck

type TaskConfigCheck int
const (
	Unvisited TaskConfigCheck = iota // 0: 未訪問
	Visiting                         // 1: 正在訪問 (當前路徑中)
	Visited                          // 2: 已訪問 (已完成遍歷)
)

Jump to

Keyboard shortcuts

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