Force cd into PKI directory

This commit is contained in:
nemunaire 2017-01-16 13:12:03 +01:00 committed by nemunaire
parent ab7d72f442
commit 95f813447c

View File

@ -51,6 +51,9 @@ func main() {
if SubmissionDir, err = filepath.Abs(SubmissionDir); err != nil {
log.Fatal(err)
}
if api.TeamsDir, err = filepath.Abs(api.TeamsDir); err != nil {
log.Fatal(err)
}
if fic.FilesDir, err = filepath.Abs(fic.FilesDir); err != nil {
log.Fatal(err)
}
@ -62,6 +65,10 @@ func main() {
baseURL = &tmp
}
if err := os.Chdir(PKIDir); err != nil {
log.Fatal("Unable to enter PKI directory at: ", err)
}
log.Println("Opening database...")
if err := fic.DBInit(fmt.Sprintf("%s?parseTime=true", *dsn)); err != nil {
log.Fatal("Cannot open the database: ", err)
@ -83,8 +90,6 @@ func main() {
}
os.Chdir(PKIDir)
log.Println(fmt.Sprintf("Ready, listening on %s", *bind))
if err := http.ListenAndServe(*bind, http.StripPrefix(*baseURL, api.Router())); err != nil {
log.Fatal("Unable to listen and serve: ", err)