fix env handling

This commit is contained in:
David Dollar
2015-02-19 09:28:19 -05:00
parent f0fe9777cd
commit 4eaf54121e
+5 -15
View File
@@ -2,10 +2,10 @@ package main
import (
"fmt"
"github.com/ddollar/forego/Godeps/_workspace/src/github.com/subosito/gotenv"
"os"
"path/filepath"
"regexp"
"github.com/ddollar/forego/Godeps/_workspace/src/github.com/subosito/gotenv"
)
var envEntryRegexp = regexp.MustCompile("^([A-Za-z_0-9]+)=(.*)$")
@@ -19,27 +19,17 @@ func (e *envFiles) String() string {
}
func (e *envFiles) Set(value string) error {
*e = append(*e, fullPath(value))
*e = append(*e, value)
return nil
}
func fullPath(file string) string {
root := filepath.Dir(".")
return filepath.Join(root, file)
}
func loadEnvs(files []string) (Env, error) {
if len(files) == 0 {
env, err := ReadEnv(fullPath(".env"))
if err != nil {
return nil, err
} else {
return env, nil
}
files = []string{".env"}
}
// Handle multiple environment files
env := make(Env)
for _, file := range files {
tmpEnv, err := ReadEnv(file)