config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config 负责加载和归一化 FlowLink 控制面的运行配置。

配置加载遵循 Switch 风格:APP_ENV 选择环境目录,FLOWLINK_CONFIG 可覆盖默认路径。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	AllowedOrigins   []string `yaml:"allowed_origins"`
	AllowedMethods   []string `yaml:"allowed_methods"`
	AllowedHeaders   []string `yaml:"allowed_headers"`
	AllowCredentials bool     `yaml:"allow_credentials"`
}

CORSConfig 配置跨域访问策略。

func (*CORSConfig) Initial

func (c *CORSConfig) Initial()

type Config

type Config struct {
	Server          *ServerConfig          `yaml:"server"`
	MySQL           *MySQLConfig           `yaml:"mysql"`
	JWT             *JWTConfig             `yaml:"jwt"`
	Worker          *WorkerConfig          `yaml:"worker"`
	WorkflowSecrets *WorkflowSecretsConfig `yaml:"workflow_secrets"`
}

Config 是控制面完整运行配置。

func Default

func Default() *Config

Default 返回控制面默认配置。

func Load

func Load() (*Config, error)

Load 按 APP_ENV/FLOWLINK_CONFIG 读取配置并填充默认值。

func (*Config) Initial

func (c *Config) Initial()

type JWTConfig

type JWTConfig struct {
	Secret                   string `yaml:"secret"`
	ExpirationHours          int    `yaml:"expiration_hours"`
	AutoLoginExpirationHours int    `yaml:"auto_login_expiration_hours"`
}

JWTConfig 配置控制面登录令牌。

type MySQLConfig

type MySQLConfig struct {
	Host      string `yaml:"host"`
	Port      int    `yaml:"port"`
	Username  string `yaml:"username"`
	Password  string `yaml:"password"`
	DBName    string `yaml:"dbname"`
	Charset   string `yaml:"charset"`
	ParseTime bool   `yaml:"parseTime"`
	Loc       string `yaml:"loc"`
	Logger    struct {
		LogLevel string `yaml:"log_level"`
	} `yaml:"logging"`
	Pool struct {
		MinConnections int   `yaml:"min_connections"`
		MaxConnections int   `yaml:"max_connections"`
		ConnectTimeout int64 `yaml:"connect_timeout"`
		MaxIdleTime    int64 `yaml:"max_idle_time"`
	} `yaml:"pool"`
}

MySQLConfig 配置控制面 MySQL 连接。

func (*MySQLConfig) Initial

func (c *MySQLConfig) Initial()

func (*MySQLConfig) ToDSN

func (c *MySQLConfig) ToDSN() string

func (*MySQLConfig) ToServerDSN

func (c *MySQLConfig) ToServerDSN() string

type ServerConfig

type ServerConfig struct {
	Port    int           `yaml:"port"`
	Version string        `yaml:"version"`
	Name    string        `yaml:"name"`
	Mode    string        `yaml:"mode"`
	CORS    *CORSConfig   `yaml:"cors"`
	Static  *StaticConfig `yaml:"static"`
}

ServerConfig 配置 HTTP 服务和静态资源服务。

func (*ServerConfig) Addr

func (c *ServerConfig) Addr() string

func (*ServerConfig) Initial

func (c *ServerConfig) Initial()

type StaticConfig

type StaticConfig struct {
	Enabled bool   `yaml:"enabled"`
	Path    string `yaml:"path"`
	Root    string `yaml:"root"`
	Index   string `yaml:"index"`
}

StaticConfig 配置后台是否托管前端构建产物。

func (*StaticConfig) Initial

func (c *StaticConfig) Initial()

type WorkerConfig

type WorkerConfig struct {
	Token string `yaml:"token"`
}

WorkerConfig 配置业务 worker 拉取发布 workflow 的认证。

func (*WorkerConfig) Initial

func (c *WorkerConfig) Initial()

type WorkflowSecretsConfig

type WorkflowSecretsConfig struct {
	Key string `yaml:"key"`
}

WorkflowSecretsConfig configures encryption of sensitive workflow node fields.

Jump to

Keyboard shortcuts

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