making changes to common library, starting to integrate database functions
This commit is contained in:
@@ -4,6 +4,7 @@ port = 80
|
||||
ip = ""
|
||||
rawport = 0
|
||||
reporootpath = "F:\\repos"
|
||||
databaselocation = "gvc.db"
|
||||
|
||||
[[repo]]
|
||||
rootpath = ""
|
||||
|
@@ -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
|
||||
|
@@ -1,16 +1,21 @@
|
||||
package config
|
||||
|
||||
import "github.com/deranjer/gvc/common"
|
||||
import (
|
||||
"github.com/asdine/storm"
|
||||
"github.com/deranjer/gvc/common"
|
||||
)
|
||||
|
||||
// GvcServerConfig will hold the base server settings
|
||||
type GvcServerConfig struct {
|
||||
LogFile string `toml:"logfile"` // Where to store the echo logs
|
||||
Version string `toml:"version"` // The server version
|
||||
Port int `toml:"port"` // The port that the server will listed on
|
||||
BindIP string `toml:"ip"` // What IP to bind the server to. If empty will bind to all interfaces
|
||||
RawPort int `toml:"rawport"` // The optional TCP port that the server will send raw files over
|
||||
RepoRootPath string `toml:"reporootpath"` // This will be the root path where (by default) all new repos will be stored at
|
||||
Repos []RepoConfig `toml:"repo"` // A struct of all the repos and their settings for the serve
|
||||
LogFile string `toml:"logfile"` // Where to store the echo logs
|
||||
DatabaseLocation string `toml:"databaselocation"` // Location of the database
|
||||
Database *storm.DB // DB Handle for passing around
|
||||
Version string `toml:"version"` // The server version
|
||||
Port int `toml:"port"` // The port that the server will listed on
|
||||
BindIP string `toml:"ip"` // What IP to bind the server to. If empty will bind to all interfaces
|
||||
RawPort int `toml:"rawport"` // The optional TCP port that the server will send raw files over
|
||||
RepoRootPath string `toml:"reporootpath"` // This will be the root path where (by default) all new repos will be stored at
|
||||
Repos []RepoConfig `toml:"repo"` // A struct of all the repos and their settings for the serve
|
||||
}
|
||||
|
||||
// RepoConfig will be the struct that holds the config for a single repo
|
||||
|
Reference in New Issue
Block a user