mirror of
https://github.com/documize/community.git
synced 2025-07-22 06:39:43 +02:00
Fixes #105
This commit is contained in:
parent
56238b00c5
commit
6fd6bc6d26
7 changed files with 663 additions and 663 deletions
|
@ -8,7 +8,7 @@ The mission is to bring software dev inspired features (refactoring, testing, li
|
|||
|
||||
## Latest version
|
||||
|
||||
v1.50.0
|
||||
v1.50.1
|
||||
|
||||
## OS Support
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ var dbPtr *sqlx.DB
|
|||
|
||||
// Check that the database is configured correctly and that all the required tables exist.
|
||||
// It must be the first function called in this package.
|
||||
func Check(runtime env.Runtime) bool {
|
||||
func Check(runtime *env.Runtime) bool {
|
||||
dbPtr = runtime.Db
|
||||
|
||||
log.Info("Database checks: started")
|
||||
|
|
|
@ -26,36 +26,6 @@ import (
|
|||
|
||||
// InitRuntime prepares runtime using command line and environment variables.
|
||||
func InitRuntime(r *env.Runtime) bool {
|
||||
// Prepare DB
|
||||
db, err := sqlx.Open("mysql", stdConn(r.Flags.DBConn))
|
||||
if err != nil {
|
||||
r.Log.Error("unable to setup database", err)
|
||||
}
|
||||
|
||||
r.Db = db
|
||||
r.Db.SetMaxIdleConns(30)
|
||||
r.Db.SetMaxOpenConns(100)
|
||||
r.Db.SetConnMaxLifetime(time.Second * 14400)
|
||||
|
||||
err = r.Db.Ping()
|
||||
if err != nil {
|
||||
r.Log.Error("unable to connect to database, connection string should be of the form: '"+
|
||||
"username:password@tcp(host:3306)/database'", err)
|
||||
return false
|
||||
}
|
||||
|
||||
// go into setup mode if required
|
||||
if r.Flags.SiteMode != web.SiteModeOffline {
|
||||
if database.Check(*r) {
|
||||
if err := database.Migrate(true /* the config table exists */); err != nil {
|
||||
r.Log.Error("unable to run database migration", err)
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
r.Log.Info("going into setup mode to prepare new database")
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare SALT
|
||||
if r.Flags.Salt == "" {
|
||||
b := make([]byte, 17)
|
||||
|
@ -90,6 +60,36 @@ func InitRuntime(r *env.Runtime) bool {
|
|||
}
|
||||
}
|
||||
|
||||
// Prepare DB
|
||||
db, err := sqlx.Open("mysql", stdConn(r.Flags.DBConn))
|
||||
if err != nil {
|
||||
r.Log.Error("unable to setup database", err)
|
||||
}
|
||||
|
||||
r.Db = db
|
||||
r.Db.SetMaxIdleConns(30)
|
||||
r.Db.SetMaxOpenConns(100)
|
||||
r.Db.SetConnMaxLifetime(time.Second * 14400)
|
||||
|
||||
err = r.Db.Ping()
|
||||
if err != nil {
|
||||
r.Log.Error("unable to connect to database, connection string should be of the form: '"+
|
||||
"username:password@tcp(host:3306)/database'", err)
|
||||
return false
|
||||
}
|
||||
|
||||
// go into setup mode if required
|
||||
if r.Flags.SiteMode != web.SiteModeOffline {
|
||||
if database.Check(r) {
|
||||
if err := database.Migrate(true /* the config table exists */); err != nil {
|
||||
r.Log.Error("unable to run database migration", err)
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
r.Log.Info("going into setup mode to prepare new database")
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ func init() {
|
|||
runtime.Product = env.ProdInfo{}
|
||||
runtime.Product.Major = "1"
|
||||
runtime.Product.Minor = "50"
|
||||
runtime.Product.Patch = "0"
|
||||
runtime.Product.Patch = "1"
|
||||
runtime.Product.Version = fmt.Sprintf("%s.%s.%s", runtime.Product.Major, runtime.Product.Minor, runtime.Product.Patch)
|
||||
runtime.Product.Edition = "Community"
|
||||
runtime.Product.Title = fmt.Sprintf("%s Edition", runtime.Product.Edition)
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "documize",
|
||||
"version": "1.50.0",
|
||||
"version": "1.50.1",
|
||||
"description": "The Document IDE",
|
||||
"private": true,
|
||||
"repository": "",
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
{
|
||||
"community":
|
||||
{
|
||||
"version": "1.50.0",
|
||||
"version": "1.50.1",
|
||||
"major": 1,
|
||||
"minor": 50,
|
||||
"patch": 0
|
||||
"patch": 1
|
||||
},
|
||||
"enterprise":
|
||||
{
|
||||
"version": "1.52.0",
|
||||
"version": "1.52.1",
|
||||
"major": 1,
|
||||
"minor": 52,
|
||||
"patch": 0
|
||||
"patch": 1
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue