Remove some unneeded database attributes
This commit is contained in:
10
app.go
10
app.go
@@ -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)
|
||||||
|
@@ -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 {
|
||||||
|
Reference in New Issue
Block a user