package schedule import ( "bufio" "os" "strings" ) // readEnvFile parses a KEY=value EnvironmentFile (blank lines and #comments // ignored). Copied from internal/activator/backend_exec.go's function of the // same name — importing activator here would be a cycle (activator is a // consumer of this package's runner), so the ~20-line parser is duplicated // rather than shared. Keep the two in sync if either changes. func readEnvFile(path string) (map[string]string, error) { f, err := os.Open(path) if err != nil { return nil, err } defer f.Close() m := map[string]string{} sc := bufio.NewScanner(f) for sc.Scan() { line := strings.TrimSpace(sc.Text()) if line == "" || strings.HasPrefix(line, "#") { continue } if k, v, ok := strings.Cut(line, "="); ok { m[strings.TrimSpace(k)] = strings.TrimSpace(v) } } return m, sc.Err() }