Remove some unneeded database attributes

This commit is contained in:
2018-11-13 01:41:08 +00:00
parent 80e66d2b32
commit 88e785e04b
2 changed files with 2 additions and 12 deletions

10
app.go
View File

@@ -203,15 +203,9 @@ func Serve() {
app.formDecoder.RegisterConverter(sql.NullFloat64{}, converter.ConvertSQLNullFloat64) app.formDecoder.RegisterConverter(sql.NullFloat64{}, converter.ConvertSQLNullFloat64)
// Check database configuration // Check database configuration
if app.cfg.Database.User == "" || app.cfg.Database.Password == "" {
log.Error("Database user or password not set.")
os.Exit(1)
}
if app.cfg.Database.Host == "" {
app.cfg.Database.Host = "localhost"
}
if app.cfg.Database.Database == "" { if app.cfg.Database.Database == "" {
app.cfg.Database.Database = "writeas" log.Error("Database filename not set.")
os.Exit(1)
} }
connectToDatabase(app) connectToDatabase(app)

View File

@@ -18,11 +18,7 @@ type (
DatabaseCfg struct { DatabaseCfg struct {
Type string `ini:"type"` Type string `ini:"type"`
User string `ini:"username"`
Password string `ini:"password"`
Database string `ini:"database"` Database string `ini:"database"`
Host string `ini:"host"`
Port int `ini:"port"`
} }
AppCfg struct { AppCfg struct {