We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5394d09 commit 228e4aeCopy full SHA for 228e4ae
README.md
@@ -289,6 +289,7 @@ Full documentation is available at [docs.daguit.dev](https://docs.daguit.dev/).
289
|---------------------|---------|-------------|
290
| `DAGU_HOME` | - | Base directory that overrides all path configurations |
291
| `DAGU_DAGS_DIR` | `~/.config/dagu/dags` | Directory for DAG definitions |
292
+| `DAGU_ALT_DAGS_DIR` | - | Additional directory to search for DAG definitions |
293
| `DAGU_LOG_DIR` | `~/.local/share/dagu/logs` | Directory for log files |
294
| `DAGU_DATA_DIR` | `~/.local/share/dagu/data` | Directory for application data |
295
| `DAGU_SUSPEND_FLAGS_DIR` | `~/.local/share/dagu/suspend` | Directory for suspend flags |
internal/cmd/context.go
@@ -377,10 +377,16 @@ type dagStoreConfig struct {
377
378
// dagStore returns a new DAGRepository instance.
379
func (c *Context) dagStore(cfg dagStoreConfig) (exec.DAGStore, error) {
380
+ // Merge configured alternate DAGs directory into search paths if provided
381
+ searchPaths := append([]string{}, cfg.SearchPaths...)
382
+ if c.Config != nil && c.Config.Paths.AltDAGsDir != "" {
383
+ searchPaths = append(searchPaths, c.Config.Paths.AltDAGsDir)
384
+ }
385
+
386
store := filedag.New(
387
c.Config.Paths.DAGsDir,
388
filedag.WithFlagsBaseDir(c.Config.Paths.SuspendFlagsDir),
- filedag.WithSearchPaths(cfg.SearchPaths),
389
+ filedag.WithSearchPaths(searchPaths),
390
filedag.WithFileCache(cfg.Cache),
391
filedag.WithSkipExamples(c.Config.Core.SkipExamples),
392
filedag.WithSkipDirectoryCreation(cfg.SkipDirectoryCreation),
internal/cmn/config/config.go
@@ -250,6 +250,7 @@ type PathsConfig struct {
250
SuspendFlagsDir string
251
AdminLogsDir string
252
BaseConfig string
253
+ AltDAGsDir string
254
DAGRunsDir string
255
QueueDir string
256
ProcDir string
internal/cmn/config/definition.go
@@ -181,6 +181,7 @@ type PathsDef struct {
181
SuspendFlagsDir string `mapstructure:"suspendFlagsDir"`
182
AdminLogsDir string `mapstructure:"adminLogsDir"`
183
BaseConfig string `mapstructure:"baseConfig"`
184
+ AltDagsDir string `mapstructure:"altDagsDir"`
185
DAGRunsDir string `mapstructure:"dagRunsDir"`
186
QueueDir string `mapstructure:"queueDir"`
187
ProcDir string `mapstructure:"procDir"`
internal/cmn/config/loader.go
@@ -312,6 +312,7 @@ func (l *ConfigLoader) loadPathsConfig(cfg *Config, def Definition) error {
312
source string
313
}{
314
{"DAGsDir", &cfg.Paths.DAGsDir, def.Paths.DAGsDir},
315
+ {"AltDAGsDir", &cfg.Paths.AltDAGsDir, def.Paths.AltDagsDir},
316
{"SuspendFlagsDir", &cfg.Paths.SuspendFlagsDir, def.Paths.SuspendFlagsDir},
317
{"DataDir", &cfg.Paths.DataDir, def.Paths.DataDir},
318
{"LogDir", &cfg.Paths.LogDir, def.Paths.LogDir},
@@ -1250,6 +1251,7 @@ var envBindings = []envBinding{
1250
1251
// Paths
1252
{key: "paths.dagsDir", env: "DAGS", isPath: true},
1253
{key: "paths.dagsDir", env: "DAGS_DIR", isPath: true},
1254
+ {key: "paths.altDagsDir", env: "ALT_DAGS_DIR", isPath: true},
1255
{key: "paths.executable", env: "EXECUTABLE", isPath: true},
1256
{key: "paths.logDir", env: "LOG_DIR", isPath: true},
1257
{key: "paths.dataDir", env: "DATA_DIR", isPath: true},
internal/cmn/config/loader_test.go
@@ -68,6 +68,7 @@ func TestLoad_Env(t *testing.T) {
68
"DAGU_PROC_DIR": filepath.Join(testPaths, "proc"),
69
"DAGU_QUEUE_DIR": filepath.Join(testPaths, "queue"),
70
"DAGU_SERVICE_REGISTRY_DIR": filepath.Join(testPaths, "service-registry"),
71
+ "DAGU_ALT_DAGS_DIR": filepath.Join(testPaths, "alt-dags"),
72
73
"DAGU_LATEST_STATUS_TODAY": "true",
74
@@ -168,6 +169,7 @@ func TestLoad_Env(t *testing.T) {
168
169
},
170
Paths: PathsConfig{
171
DAGsDir: filepath.Join(testPaths, "dags"),
172
+ AltDAGsDir: filepath.Join(testPaths, "alt-dags"),
173
Executable: filepath.Join(testPaths, "bin", "dagu"),
174
LogDir: filepath.Join(testPaths, "logs"),
175
DataDir: filepath.Join(testPaths, "data"),
internal/persis/filedag/store.go
@@ -81,15 +81,15 @@ func New(baseDir string, opts ...Option) exec.DAGStore {
81
if options.FlagsBaseDir == "" {
82
options.FlagsBaseDir = filepath.Join(baseDir, "flags")
83
}
84
- uniqSearchPaths := make(map[string]struct{})
85
- uniqSearchPaths[baseDir] = struct{}{}
86
- uniqSearchPaths["."] = struct{}{}
87
- for _, path := range options.SearchPaths {
88
- uniqSearchPaths[path] = struct{}{}
89
- }
90
- searchPaths := make([]string, 0, len(uniqSearchPaths))
91
- for path := range uniqSearchPaths {
92
- searchPaths = append(searchPaths, path)
+ // Build search paths in deterministic order: baseDir first, then ".", then additional paths.
+ seen := make(map[string]struct{})
+ var searchPaths []string
+ for _, p := range append([]string{baseDir, "."}, options.SearchPaths...) {
+ if _, ok := seen[p]; ok {
+ continue
+ seen[p] = struct{}{}
+ searchPaths = append(searchPaths, p)
93
94
95
return &Storage{
0 commit comments