From 3f5631d2d839f18cf60c44b63d08b82f4070725e Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 4 Oct 2011 16:22:12 -0700 Subject: [PATCH] serverconfig: push abs path business to caller --- lib/go/camli/serverconfig/serverconfig.go | 6 ------ server/go/camlistored/camlistored.go | 7 ++++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/go/camli/serverconfig/serverconfig.go b/lib/go/camli/serverconfig/serverconfig.go index 6044c03e8..80b9d4e5c 100644 --- a/lib/go/camli/serverconfig/serverconfig.go +++ b/lib/go/camli/serverconfig/serverconfig.go @@ -21,7 +21,6 @@ import ( "http" "log" "os" - "path/filepath" "strings" "camli/auth" @@ -29,7 +28,6 @@ import ( "camli/blobserver/handlers" "camli/httputil" "camli/jsonconfig" - "camli/osutil" ) const camliPrefix = "/camli/" @@ -240,10 +238,6 @@ type Config struct { } func Load(configPath string) (*Config, os.Error) { - if !filepath.IsAbs(configPath) { - configPath = filepath.Join(osutil.CamliConfigDir(), configPath) - } - obj, err := jsonconfig.ReadFile(configPath) if err != nil { return nil, err diff --git a/server/go/camlistored/camlistored.go b/server/go/camlistored/camlistored.go index d359c8bc6..7d96ff3f2 100644 --- a/server/go/camlistored/camlistored.go +++ b/server/go/camlistored/camlistored.go @@ -23,6 +23,7 @@ import ( "runtime" "strings" "os" + "path/filepath" "camli/osutil" "camli/serverconfig" @@ -54,7 +55,11 @@ func exitFailure(pattern string, args ...interface{}) { func main() { flag.Parse() - config, err := serverconfig.Load(*flagConfigFile) + file := *flagConfigFile + if !filepath.IsAbs(file) { + file = filepath.Join(osutil.CamliConfigDir(), file) + } + config, err := serverconfig.Load(file) if err != nil { exitFailure("Could not load server config: %v", err) }