config

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: GPL-2.0, GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth added in v1.16.0

type Auth struct {
	Basic AuthBasic `mapstructure:"basic"`
	Token AuthToken `mapstructure:"token"`
}

Auth represents the authentication configuration

type AuthBasic added in v1.16.0

type AuthBasic struct {
	Enabled  bool   `mapstructure:"enabled"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

AuthBasic represents the basic authentication configuration

type AuthToken added in v1.16.0

type AuthToken struct {
	Enabled bool   `mapstructure:"enabled"`
	Value   string `mapstructure:"value"`
}

AuthToken represents the authentication token configuration

type Config

type Config struct {
	// Server settings
	Host        string `mapstructure:"host"`
	Port        int    `mapstructure:"port"`
	Debug       bool   `mapstructure:"debug"`
	BasePath    string `mapstructure:"basePath"`
	APIBasePath string `mapstructure:"apiBasePath"`
	APIBaseURL  string `mapstructure:"apiBaseURL"` // For backward compatibility
	WorkDir     string `mapstructure:"workDir"`

	// Authentication
	Auth Auth `mapstructure:"auth"`

	// File system paths
	Paths PathsConfig `mapstructure:"paths"`

	// Legacy fields for backward compatibility - Start
	// Note: These fields are used for backward compatibility and should not be used in new code
	// Deprecated: Use Auth.Basic.Enabled instead
	DAGs string `mapstructure:"dags"`
	// Deprecated: Use Paths.Executable instead
	Executable string `mapstructure:"executable"`
	// Deprecated: Use Paths.LogDir instead
	LogDir string `mapstructure:"logDir"`
	// Deprecated: Use Paths.DataDir instead
	DataDir string `mapstructure:"dataDir"`
	// Deprecated: Use Paths.SuspendFlagsDir instead
	SuspendFlagsDir string `mapstructure:"suspendFlagsDir"`
	// Deprecated: Use Paths.AdminLogsDir instead
	AdminLogsDir string `mapstructure:"adminLogsDir"`
	// Deprecated: Use Paths.BaseConfig instead
	BaseConfig string `mapstructure:"baseConfig"`
	// Deprecated: Use Auth.Token.Enabled instead
	IsBasicAuth bool `mapstructure:"isBasicAuth"`
	// Deprecated: Use Auth.Basic.Username instead
	BasicAuthUsername string `mapstructure:"basicAuthUsername"`
	// Deprecated: Use Auth.Basic.Password instead
	BasicAuthPassword string `mapstructure:"basicAuthPassword"`
	// Deprecated: Use Auth.Token.Enabled instead
	IsAuthToken bool `mapstructure:"isAuthToken"`
	// Deprecated: Use Auth.Token.Value instead
	AuthToken string `mapstructure:"authToken"`
	// Deprecated: Use UI.LogEncodingCharset instead
	LogEncodingCharset string `mapstructure:"logEncodingCharset"`
	// Deprecated: Use UI.NavbarColor instead
	NavbarColor string `mapstructure:"navbarColor"`
	// Deprecated: Use UI.NavbarTitle instead
	NavbarTitle string `mapstructure:"navbarTitle"`
	// Deprecated: Use UI.MaxDashboardPageLimit instead
	MaxDashboardPageLimit int `mapstructure:"maxDashboardPageLimit"`

	// Other settings
	LogFormat         string         `mapstructure:"logFormat"`
	LatestStatusToday bool           `mapstructure:"latestStatusToday"`
	TZ                string         `mapstructure:"tz"`
	Location          *time.Location `mapstructure:"-"`
	Env               sync.Map       `mapstructure:"-"`

	UI UI `mapstructure:"ui"`

	// Remote nodes configuration
	RemoteNodes []RemoteNode `mapstructure:"remoteNodes"`

	// TLS configuration
	TLS *TLSConfig `mapstructure:"tls"`
}

Config represents the server configuration with both new and legacy fields

func Load

func Load() (*Config, error)

Load creates a new configuration with backward compatibility

func (*Config) MigrateLegacyConfig added in v1.16.0

func (c *Config) MigrateLegacyConfig()

MigrateLegacyConfig migrates legacy configuration

type ConfigLoader added in v1.16.0

type ConfigLoader struct {
	// contains filtered or unexported fields
}

func NewConfigLoader added in v1.16.0

func NewConfigLoader() *ConfigLoader

func (*ConfigLoader) Load added in v1.16.0

func (l *ConfigLoader) Load() (*Config, error)

func (*ConfigLoader) LoadLegacyEnv added in v1.16.0

func (l *ConfigLoader) LoadLegacyEnv(cfg *Config) error

type PathResolver added in v1.16.0

type PathResolver struct {
	Paths
	XDGConfig
}

type Paths added in v1.16.0

type Paths struct {
	ConfigDir       string
	DAGsDir         string
	SuspendFlagsDir string
	DataDir         string
	LogsDir         string
	AdminLogsDir    string
	BaseConfigFile  string
}

type PathsConfig added in v1.16.0

type PathsConfig struct {
	DAGsDir         string `mapstructure:"dagsDir"`
	Executable      string `mapstructure:"executable"`
	LogDir          string `mapstructure:"logDir"`
	DataDir         string `mapstructure:"dataDir"`
	SuspendFlagsDir string `mapstructure:"suspendFlagsDir"`
	AdminLogsDir    string `mapstructure:"adminLogsDir"`
	BaseConfig      string `mapstructure:"baseConfig"`
}

Paths represents the file system paths configuration

type RemoteNode added in v1.15.0

type RemoteNode struct {
	Name              string `mapstructure:"name"`
	APIBaseURL        string `mapstructure:"apiBaseURL"`
	IsBasicAuth       bool   `mapstructure:"isBasicAuth"`
	BasicAuthUsername string `mapstructure:"basicAuthUsername"`
	BasicAuthPassword string `mapstructure:"basicAuthPassword"`
	IsAuthToken       bool   `mapstructure:"isAuthToken"`
	AuthToken         string `mapstructure:"authToken"`
	SkipTLSVerify     bool   `mapstructure:"skipTLSVerify"`
}

RemoteNode represents a remote node configuration

type TLSConfig added in v1.16.0

type TLSConfig struct {
	CertFile string `mapstructure:"certFile"`
	KeyFile  string `mapstructure:"keyFile"`
}

TLSConfig represents TLS configuration

type UI added in v1.16.0

type UI struct {
	LogEncodingCharset    string `mapstructure:"logEncodingCharset"`
	NavbarColor           string `mapstructure:"navbarColor"`
	NavbarTitle           string `mapstructure:"navbarTitle"`
	MaxDashboardPageLimit int    `mapstructure:"maxDashboardPageLimit"`
}

type XDGConfig

type XDGConfig struct {
	DataHome   string
	ConfigHome string
}

Jump to

Keyboard shortcuts

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