Skip to content

Commit

Permalink
[#800] docs: headless mode (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohamta authored Feb 1, 2025
1 parent 4766a18 commit 76876f2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docs/source/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Server Configuration
- ``DAGU_TZ`` (``""``): Server timezone (default: system timezone, e.g., ``Asia/Tokyo``)
- ``DAGU_CERT_FILE``: SSL certificate file path
- ``DAGU_KEY_FILE``: SSL key file path
- ``DAGU_HEADLESS`` (``""``): Run the server in headless mode (1=enabled)

Directory Paths
~~~~~~~~~~~~~
Expand Down Expand Up @@ -72,6 +73,7 @@ Create ``config.yaml`` in ``$HOME/.config/dagu/`` to override default settings.
navbarColor: "#ff0000" # Header color
navbarTitle: "Dagu - PROD" # Header title
latestStatusToday: true # Show today's latest status
headless: true # Run in headless mode
# Authentication
isBasicAuth: true # Enable basic auth
Expand Down
8 changes: 2 additions & 6 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Config struct {
APIBasePath string `mapstructure:"apiBasePath"`
APIBaseURL string `mapstructure:"apiBaseURL"` // For backward compatibility
WorkDir string `mapstructure:"workDir"`
Headless bool `mapstructure:"headless"`

// Authentication
Auth Auth `mapstructure:"auth"`
Expand Down Expand Up @@ -58,8 +59,7 @@ type Config struct {
// Deprecated: Use UI.NavbarTitle instead
NavbarTitle string `mapstructure:"navbarTitle"`
// Deprecated: Use UI.MaxDashboardPageLimit instead
MaxDashboardPageLimit int `mapstructure:"maxDashboardPageLimit"`
Headless bool `mapstructure:"headless"`
MaxDashboardPageLimit int `mapstructure:"maxDashboardPageLimit"`
// Legacy fields for backward compatibility - End

// Other settings
Expand Down Expand Up @@ -113,7 +113,6 @@ type UI struct {
NavbarColor string `mapstructure:"navbarColor"`
NavbarTitle string `mapstructure:"navbarTitle"`
MaxDashboardPageLimit int `mapstructure:"maxDashboardPageLimit"`
Headless bool `mapstructure:"headless"`
}

// RemoteNode represents a remote node configuration
Expand Down Expand Up @@ -208,9 +207,6 @@ func (c *Config) migrateUISettings() {
if c.MaxDashboardPageLimit > 0 {
c.UI.MaxDashboardPageLimit = c.MaxDashboardPageLimit
}
if c.Headless {
c.UI.Headless = c.Headless
}
}

func (c *Config) cleanBasePath() {
Expand Down
2 changes: 1 addition & 1 deletion internal/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ func (l *ConfigLoader) bindEnvironmentVariables() {
l.bindEnv("host", "HOST")
l.bindEnv("port", "PORT")
l.bindEnv("debug", "DEBUG")
l.bindEnv("headless", "HEADLESS")

// UI configurations
l.bindEnv("ui.maxDashboardPageLimit", "UI_MAX_DASHBOARD_PAGE_LIMIT")
l.bindEnv("ui.logEncodingCharset", "UI_LOG_ENCODING_CHARSET")
l.bindEnv("ui.navbarColor", "UI_NAVBAR_COLOR")
l.bindEnv("ui.navbarTitle", "UI_NAVBAR_TITLE")
l.bindEnv("ui.headless", "UI_HEADLESS")

// UI configurations (legacy)
l.bindEnv("ui.maxDashboardPageLimit", "MAX_DASHBOARD_PAGE_LIMIT")
Expand Down
2 changes: 1 addition & 1 deletion internal/frontend/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func New(cfg *config.Config, cli client.Client) *server.Server {
APIBaseURL: cfg.APIBaseURL,
TimeZone: cfg.TZ,
RemoteNodes: remoteNodes,
Headless: cfg.UI.Headless,
Headless: cfg.Headless,
}

if cfg.Auth.Token.Enabled {
Expand Down

0 comments on commit 76876f2

Please sign in to comment.