diff --git a/pkg/serverinit/serverinit.go b/pkg/serverinit/serverinit.go index c88722874..0cd472bc4 100644 --- a/pkg/serverinit/serverinit.go +++ b/pkg/serverinit/serverinit.go @@ -26,7 +26,6 @@ import ( "expvar" "fmt" "io" - "io/ioutil" "log" "net/http" "net/http/pprof" @@ -44,6 +43,7 @@ import ( "camlistore.org/pkg/jsonconfig" "camlistore.org/pkg/server/app" "camlistore.org/pkg/types/serverconfig" + "camlistore.org/pkg/wkfs" ) const camliPrefix = "/camli/" @@ -466,7 +466,7 @@ func load(filename string, rootConfig []byte, opener func(filename string) (json } if rootConfig == nil { - rootConfig, err = ioutil.ReadFile(filename) + rootConfig, err = wkfs.ReadFile(filename) if err != nil { return nil, fmt.Errorf("Could not read %s: %v", filename, err) } diff --git a/pkg/wkfs/wkfs.go b/pkg/wkfs/wkfs.go index d670dc7f8..65235fbac 100644 --- a/pkg/wkfs/wkfs.go +++ b/pkg/wkfs/wkfs.go @@ -29,6 +29,7 @@ package wkfs import ( "io" + "io/ioutil" "os" "strings" ) @@ -118,3 +119,12 @@ func WriteFile(filename string, data []byte, perm os.FileMode) error { } return err } + +func ReadFile(filename string) ([]byte, error) { + f, err := Open(filename) + if err != nil { + return nil, err + } + defer f.Close() + return ioutil.ReadAll(f) +}