making changes to common library, starting to integrate database functions

This commit is contained in:
2020-06-11 17:24:35 -04:00
parent 0ecb0b96ce
commit d335549fd5
15 changed files with 317 additions and 145 deletions

View File

@@ -5,6 +5,7 @@ import (
"log"
"os"
"github.com/deranjer/gvc/common/database"
"github.com/deranjer/gvc/server/engine"
serverconfig "github.com/deranjer/gvc/server/serverconfig"
"github.com/deranjer/store"
@@ -24,10 +25,11 @@ func main() {
fmt.Printf("Unable to find config file: %s\n", err)
fmt.Println("Since no config found, creating a default config to use...")
conf = serverconfig.GvcServerConfig{
LogFile: "gvclog.log",
Version: "0.1",
Port: 80,
RepoRootPath: "repos", //default repos directory will be cwd\repos
LogFile: "gvclog.log",
Version: "0.1",
Port: 80,
RepoRootPath: "repos", //default repos directory will be cwd\repos
DatabaseLocation: "gvc.db", //database is stored in root dir by default
}
configPath = serverconfig.DefaultConfigPath // set the root path for our config so we can save that back to TOML
err = store.Save(serverconfig.DefaultConfigPath, &conf) // Save our new default config back to TOML so it can be read in
@@ -53,6 +55,8 @@ func main() {
log.Fatalf("unable to open log file at: %s, exiting with error: %s", conf.LogFile, err)
}
defer logFile.Close()
// Check/Setup the database
database.NewDB(conf.DatabaseLocation)
// Setup the web server
e := echo.New()
// Setup the logger to print to the file specified in config