mirror of https://github.com/perkeep/perkeep.git
serverconfig: push abs path business to caller
This commit is contained in:
parent
7c2f4b57ef
commit
3f5631d2d8
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue