d9414e4cba
Full DAG engine app with CLI subcommands (run, list, status, validate, server) and React/Mantine web frontend. Uses net/http + embedded Vite build. SQLite store for run history. Scheduler with cron_ticker for automated execution. Compatible with existing dagu YAML format. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
35 lines
914 B
Go
35 lines
914 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// Config holds the runtime configuration for the DAG engine.
|
|
type Config struct {
|
|
Port int
|
|
DagsDir string
|
|
DBPath string
|
|
AutoScheduler bool
|
|
}
|
|
|
|
// DefaultConfig returns sensible defaults.
|
|
func DefaultConfig() Config {
|
|
home, _ := os.UserHomeDir()
|
|
return Config{
|
|
Port: 8090,
|
|
DagsDir: filepath.Join(home, "dagu", "dags"),
|
|
DBPath: "dag_engine.db",
|
|
}
|
|
}
|
|
|
|
// ParseFlags populates config from CLI flags for the "server" subcommand.
|
|
func (c *Config) ParseFlags(fs *flag.FlagSet, args []string) error {
|
|
fs.IntVar(&c.Port, "port", c.Port, "HTTP server port")
|
|
fs.StringVar(&c.DagsDir, "dags-dir", c.DagsDir, "directory containing DAG YAML files")
|
|
fs.StringVar(&c.DBPath, "db", c.DBPath, "path to SQLite database")
|
|
fs.BoolVar(&c.AutoScheduler, "scheduler", c.AutoScheduler, "auto-start cron scheduler")
|
|
return fs.Parse(args)
|
|
}
|