Skip to content

Commit 2759e8c

Browse files
committed
fixed fexec common env
1 parent 3e420da commit 2759e8c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

cmd/fexec/main.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ func main() {
6767
return
6868
}
6969

70-
commonEnv := []string{
71-
fmt.Sprintf("NOW=%s", time.Now().Format(time.RFC3339)),
70+
if err = SetupCommonEnv(); err != nil {
71+
log.Fatalf("setting up common env: %s", err)
7272
}
7373

7474
modules := framework.Modules{}
@@ -81,7 +81,7 @@ func main() {
8181
modules[name] = &framework.CommandModule[any]{
8282
Command: module.Command,
8383
Dir: module.Dir,
84-
Env: append(commonEnv, module.Env...),
84+
Env: module.Env,
8585
DependsOn: module.DependsOn,
8686
}
8787
}
@@ -102,3 +102,14 @@ func ParseConfig(path string) (*CommandConfig, error) {
102102

103103
return cfg, nil
104104
}
105+
106+
func SetupCommonEnv() error {
107+
for k, v := range map[string]string{
108+
"NOW": time.Now().Format(time.RFC3339),
109+
} {
110+
if err := os.Setenv(k, v); err != nil {
111+
return fmt.Errorf("%q: %w", k, err)
112+
}
113+
}
114+
return nil
115+
}

0 commit comments

Comments
 (0)