Skip to content

Commit ea10d08

Browse files
committed
add "dotenv" setting to config file to specify the dotenv filenames to load
1 parent dfc7445 commit ea10d08

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/app/app.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ func (a *Application) Run() {
333333
}
334334

335335
a.Workflow.Initialize()
336+
godotenv.Load(a.Workflow.Settings.DotEnvFiles...)
337+
a.JsEngine.CreateEnvironmentVariables()
336338
a.JsEngine.CreateAppVariables()
337339

338340
a.hookSignals()

lib/app/workflow.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type WorkflowSettings struct {
4343
Defaults *WorkflowSettingsDefaults `yaml:"defaults"`
4444
RemoteIndexUrl string `yaml:"remote-index-url"`
4545
ExitOnChecksumMismatch bool `yaml:"exit-on-checksum-mismatch"`
46+
DotEnvFiles []string `yaml:"dotenv"`
4647
}
4748

4849
type WorkflowSettingsDefaults struct {
@@ -278,6 +279,7 @@ func (workflow *StackupWorkflow) Initialize() {
278279
// no default settings were provided, so create sensible defaults
279280
if workflow.Settings == nil {
280281
workflow.Settings = &WorkflowSettings{
282+
DotEnvFiles: []string{".env"},
281283
Defaults: &WorkflowSettingsDefaults{
282284
Tasks: &WorkflowSettingsDefaultsTasks{
283285
Silent: false,
@@ -288,6 +290,10 @@ func (workflow *StackupWorkflow) Initialize() {
288290
}
289291
}
290292

293+
if len(workflow.Settings.DotEnvFiles) == 0 {
294+
workflow.Settings.DotEnvFiles = []string{".env"}
295+
}
296+
291297
// copy the default settings into each task if appropriate
292298
for _, task := range workflow.Tasks {
293299
if task.Path == "" && len(workflow.Settings.Defaults.Tasks.Path) > 0 {

0 commit comments

Comments
 (0)