Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Global contains global configuration settings. Global Global // Server contains the API server configuration. Server Server // Paths holds various filesystem path configurations used throughout the application. Paths PathsConfig // UI contains settings specific to the application's user interface. UI UI // Warnings contains a list of warnings generated during the configuration loading process. Warnings []string }
Config holds the overall configuration for the application.
func Load ¶
func Load(opts ...ConfigLoaderOption) (*Config, error)
Load creates a new configuration by instantiating a ConfigLoader with the provided options and then invoking its Load method.
type ConfigLoader ¶ added in v1.16.0
type ConfigLoader struct {
// contains filtered or unexported fields
}
ConfigLoader is responsible for reading and merging configuration from various sources. The internal mutex ensures thread-safety when loading the configuration.
func NewConfigLoader ¶ added in v1.16.0
func NewConfigLoader(options ...ConfigLoaderOption) *ConfigLoader
NewConfigLoader creates a new ConfigLoader instance and applies all given options.
func (*ConfigLoader) Load ¶ added in v1.16.0
func (l *ConfigLoader) Load() (*Config, error)
Load initializes viper, reads configuration files, handles legacy configuration, and returns a fully built and validated Config instance.
func (*ConfigLoader) LoadLegacyEnv ¶ added in v1.16.0
func (l *ConfigLoader) LoadLegacyEnv(cfg *Config)
LoadLegacyEnv maps legacy environment variables to their new counterparts in the configuration. If a legacy env var is set, a warning is logged and the corresponding setter function is called.
func (*ConfigLoader) LoadLegacyFields ¶ added in v1.16.4
func (l *ConfigLoader) LoadLegacyFields(cfg *Config, def Definition)
LoadLegacyFields copies values from legacy configuration fields into the current Config structure. Legacy fields are only applied if they are non-empty or non-zero, and may override the new settings.
type ConfigLoaderOption ¶ added in v1.16.2
type ConfigLoaderOption func(*ConfigLoader)
ConfigLoaderOption defines a functional option for configuring a ConfigLoader.
func WithConfigFile ¶ added in v1.16.2
func WithConfigFile(configFile string) ConfigLoaderOption
WithConfigFile returns a ConfigLoaderOption that sets the configuration file path.
type Definition ¶ added in v1.16.4
type Definition struct { // Host defines the hostname or IP address on which the application will run. Host string `mapstructure:"host"` // Port specifies the network port for incoming connections. Port int `mapstructure:"port"` // Debug toggles debug mode; when true, the application may output extra logs and error details. Debug bool `mapstructure:"debug"` // BasePath is the root URL path from which the application is served. // This is useful when hosting the app behind a reverse proxy under a subpath. BasePath string `mapstructure:"basePath"` // APIBasePath sets the base path for all API endpoints provided by the application. APIBasePath string `mapstructure:"apiBasePath"` // APIBaseURL is a deprecated field that previously specified the full base URL for the API. // Use APIBasePath instead. APIBaseURL string `mapstructure:"apiBaseURL"` // WorkDir specifies the default working directory for DAG (Directed Acyclic Graph) files. // If not explicitly provided, it defaults to the directory where the DAG file resides. WorkDir string `mapstructure:"workDir"` // Headless determines if the application should run without a graphical user interface. // Useful for automated or headless server environments. Headless *bool `mapstructure:"headless"` // Auth contains authentication settings (such as credentials or tokens) needed to secure the application. Auth *authDef `mapstructure:"auth"` // Paths holds various filesystem path configurations used throughout the application. Paths *pathsConfigDef `mapstructure:"paths"` // LogFormat defines the output format for log messages (e.g., JSON, plain text). // Available options: "json", "text" LogFormat string `mapstructure:"logFormat"` // LatestStatusToday indicates whether the application should display only the most recent status for the current day. LatestStatusToday *bool `mapstructure:"latestStatusToday"` // TZ represents the timezone setting for the application (for example, "UTC" or "America/New_York"). TZ string `mapstructure:"tz"` // UI contains settings specific to the application's user interface. UI *uiDef `mapstructure:"ui"` // RemoteNodes holds a list of configurations for connecting to remote nodes. // This enables the management of DAGs on external servers. RemoteNodes []remoteNodeDef `mapstructure:"remoteNodes"` // TLS contains configuration details for enabling TLS/SSL encryption, // such as certificate and key file paths. TLS *tlsConfigDef `mapstructure:"tls"` // DAGs is a legacy field that was previously used to configure DAG-related settings. // Deprecated: Use Auth.Basic.Enabled instead. DAGs string `mapstructure:"dags"` // DAGsDir specifies the directory where DAG files are stored. // Deprecated: Use Paths.DAGsDir instead. DAGsDir string `mapstructure:"dagsDir"` // Executable indicates the path to the executable used for running DAG tasks. // Deprecated: Use Paths.Executable instead. Executable string `mapstructure:"executable"` // LogDir defines the directory where log files are saved. // Deprecated: Use Paths.LogDir instead. LogDir string `mapstructure:"logDir"` // DataDir specifies the directory for storing application data, such as history or state. // Deprecated: Use Paths.DataDir instead. DataDir string `mapstructure:"dataDir"` // SuspendFlagsDir sets the directory used for storing flags that indicate a DAG is suspended. // Deprecated: Use Paths.SuspendFlagsDir instead. SuspendFlagsDir string `mapstructure:"suspendFlagsDir"` // AdminLogsDir indicates the directory for storing administrative logs. // Deprecated: Use Paths.AdminLogsDir instead. AdminLogsDir string `mapstructure:"adminLogsDir"` // BaseConfig provides the path to a base configuration file shared across DAGs. // Deprecated: Use Paths.BaseConfig instead. BaseConfig string `mapstructure:"baseConfig"` // IsBasicAuth indicates whether basic authentication is enabled. // Deprecated: Use Auth.Token.Enabled instead. IsBasicAuth bool `mapstructure:"isBasicAuth"` // BasicAuthUsername holds the username for basic authentication. // Deprecated: Use Auth.Basic.Username instead. BasicAuthUsername string `mapstructure:"basicAuthUsername"` // BasicAuthPassword holds the password for basic authentication. // Deprecated: Use Auth.Basic.Password instead. BasicAuthPassword string `mapstructure:"basicAuthPassword"` // IsAuthToken indicates whether token-based authentication is enabled. // Deprecated: Use Auth.Token.Enabled instead. IsAuthToken bool `mapstructure:"isAuthToken"` // AuthToken holds the token value for API authentication. // Deprecated: Use Auth.Token.Value instead. AuthToken string `mapstructure:"authToken"` // LogEncodingCharset defines the character encoding used in log files. // 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"` // MaxDashboardPageLimit limits the number of dashboard pages that can be shown in the UI. // Deprecated: Use UI.MaxDashboardPageLimit instead. MaxDashboardPageLimit int `mapstructure:"maxDashboardPageLimit"` }
Definition holds the overall configuration for the application. Each field maps to a configuration key defined in external sources (like YAML files) via the "mapstructure" tags. Some fields are legacy and maintained only for backward compatibility.
type Global ¶ added in v1.16.4
type Global struct { // Debug toggles debug mode; when true, the application may output extra logs and error details. Debug bool // LogFormat defines the output format for log messages (e.g., JSON, plain text). LogFormat string // TZ represents the timezone setting for the application (for example, "UTC" or "America/New_York"). TZ string // Location represents the time location for the application based on the TZ setting. Location *time.Location // WorkDir specifies the default working directory for DAG (Directed Acyclic Graph) files. // If not explicitly provided, it defaults to the directory where the DAG file resides. WorkDir string }
type PathResolver ¶ added in v1.16.0
PathResolver consolidates both custom paths and XDG configuration values. The resulting paths will be determined based on environment variables, legacy configuration, or default XDG-based paths.
func NewResolver ¶ added in v1.16.4
func NewResolver(appHomeEnv, legacyPath string, xdg XDGConfig) PathResolver
NewResolver instantiates a PathResolver based on the provided application home environment variable, a legacy path, and an XDGConfig. It chooses the configuration directory based on these inputs.
type Paths ¶ added in v1.16.0
type Paths struct { // ConfigDir is the primary configuration directory. ConfigDir string // DAGsDir is the directory containing DAG definitions. DAGsDir string // SuspendFlagsDir is the directory for storing flags that indicate DAG suspension. SuspendFlagsDir string // DataDir is the directory for persisting application data (e.g., history). DataDir string // LogsDir is the directory where application logs are stored. LogsDir string // AdminLogsDir is the directory where administrative logs are kept. AdminLogsDir string // BaseConfigFile is the full path to the base configuration file. BaseConfigFile string // Warnings collects any warnings encountered during path resolution. Warnings []string }
Paths holds various file system path settings used by the application.
type PathsConfig ¶ added in v1.16.0
type PathsConfig struct { DAGsDir string Executable string LogDir string DataDir string SuspendFlagsDir string AdminLogsDir string BaseConfig string }
Paths represents the file system paths configuration
type RemoteNode ¶ added in v1.15.0
type RemoteNode struct { Name string APIBaseURL string IsBasicAuth bool BasicAuthUsername string BasicAuthPassword string IsAuthToken bool AuthToken string SkipTLSVerify bool }
RemoteNode represents a remote node configuration
type Server ¶ added in v1.16.4
type Server struct { // Host defines the hostname or IP address on which the application will run. Host string // Port specifies the network port for incoming connections. Port int // BasePath is the root URL path from which the application is served. // This is useful when hosting the app behind a reverse proxy under a subpath. BasePath string // APIBasePath sets the base path for all API endpoints provided by the application. APIBasePath string // Headless determines if the application should run without a graphical user interface. // Useful for automated or headless server environments. Headless bool // LatestStatusToday indicates whether the application should display only the most recent status for the current day. LatestStatusToday bool // TLS contains configuration details for enabling TLS/SSL encryption, // such as certificate and key file paths. TLS *TLSConfig // Auth contains authentication settings (such as credentials or tokens) needed to secure the application. Auth Auth // RemoteNodes holds a list of configurations for connecting to remote nodes. // This enables the management of DAGs on external servers. RemoteNodes []RemoteNode }
Server contains the API server configuration