serverconfig: push abs path business to caller

This commit is contained in:
Brad Fitzpatrick 2011-10-04 16:22:12 -07:00
parent 7c2f4b57ef
commit 3f5631d2d8
2 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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)
}