(start string)
| 56 | } |
| 57 | |
| 58 | func walkUpward(start string) string { |
| 59 | dir := start |
| 60 | for { |
| 61 | candidate := filepath.Join(dir, ".env") |
| 62 | if pathutil.Exists(candidate) { |
| 63 | return candidate |
| 64 | } |
| 65 | if pathutil.Exists(filepath.Join(dir, ".git")) { |
| 66 | return "" |
| 67 | } |
| 68 | parent := filepath.Dir(dir) |
| 69 | if parent == dir { |
| 70 | return "" |
| 71 | } |
| 72 | dir = parent |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | // Load reads path and returns the parsed key/value pairs. An error from Load |
| 77 | // indicates a syntactically invalid file; missing files are surfaced as the |