-
-
Notifications
You must be signed in to change notification settings - Fork 196
Open
Labels
enhancementNew feature to be implementedNew feature to be implemented
Description
Overview
Enhance Dagu's configuration files with Go template support, enabling dynamic content generation and variable substitution using Go's template/text
package. Additionally, incorporate the rich set of utility functions from sprig
to provide powerful template operations.
Features
- Full Go template syntax support in most configuration fields
- Access to all sprig template functions (string operations, math, lists, etc.)
- Variable substitution across configuration
- Environment variable support
- Built-in helper functions
Example Usage
Basic variable substitution:
name: example
params:
NAME: "World"
GREETING: "Hello"
steps:
- name: simple-greeting
command: "{{.GREETING}}, {{.NAME}}!"
Using sprig functions:
name: templating-example
params:
USER: "alice"
ENV: "production"
steps:
- name: conditional-step
command: |
{{- if eq .ENV "production" -}}
deploy --production --user {{.USER | upper}}
{{- else -}}
deploy --staging --user {{.USER | lower}}
{{- end -}}
- name: date-based-task
command: "backup-{{now | date \"2006-01-02\"}}.tar.gz"
Environment variables can be accessed using the env
function:
steps:
- name: env-aware
command: "deploy --token {{env "API_TOKEN"}}"
This enhancement would make Dagu configurations more flexible and powerful, allowing for dynamic content generation based on variables, environment, and runtime conditions.
Metadata
Metadata
Assignees
Labels
enhancementNew feature to be implementedNew feature to be implemented