From f5d9fa49a3a8561fbe52d502a3f5b7faabca266d Mon Sep 17 00:00:00 2001 From: Harvey Kandola Date: Fri, 20 May 2016 14:26:13 -0700 Subject: [PATCH] Fixed up DB check code to strip MySL version suffix strings --- documize/api/endpoint/router.go | 5 +++++ documize/database/check.go | 19 ++++++++++++------- documize/web/web.go | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/documize/api/endpoint/router.go b/documize/api/endpoint/router.go index a030826b..86f6e166 100644 --- a/documize/api/endpoint/router.go +++ b/documize/api/endpoint/router.go @@ -230,6 +230,11 @@ func cors(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { func metrics(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { w.Header().Add("X-Documize-Version", AppVersion) w.Header().Add("Cache-Control", "no-cache") + + // if certFile != "" && keyFile != "" { + // w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains") + // } + next(w, r) } diff --git a/documize/database/check.go b/documize/database/check.go index 701399c5..c3ca616f 100644 --- a/documize/database/check.go +++ b/documize/database/check.go @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// This software (Documize Community Edition) is licensed under // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html // // You can operate outside the AGPL restrictions by purchasing // Documize Enterprise Edition and obtaining a commercial license -// by contacting . +// by contacting . // // https://documize.com @@ -34,12 +34,12 @@ var lockDB func() (bool, error) var unlockDB func() // Check that the database is configured correctly and that all the required tables exist. -// It must be the first function called in the -func Check(Db *sqlx.DB, connectionString string,lDB func() (bool, error),ulDB func()) bool { +// It must be the first function called in the +func Check(Db *sqlx.DB, connectionString string, lDB func() (bool, error), ulDB func()) bool { dbPtr = &Db - lockDB=lDB - unlockDB=ulDB - + lockDB = lDB + unlockDB = ulDB + csBits := strings.Split(connectionString, "/") if len(csBits) > 1 { web.SiteInfo.DBname = strings.Split(csBits[len(csBits)-1], "?")[0] @@ -67,6 +67,11 @@ func Check(Db *sqlx.DB, connectionString string,lDB func() (bool, error),ulDB fu return false } + // See http://dba.stackexchange.com/questions/63763/is-there-any-difference-between-these-two-version-of-mysql-5-1-73-community-lo + version = strings.Replace(version, "-log", "", 1) + version = strings.Replace(version, "-debug", "", 1) + version = strings.Replace(version, "-demo", "", 1) + { // check minimum MySQL version as we need JSON column type. 5.7.10 vParts := strings.Split(version, ".") if len(vParts) < 3 { diff --git a/documize/web/web.go b/documize/web/web.go index 7c1546f2..e17fa7b3 100644 --- a/documize/web/web.go +++ b/documize/web/web.go @@ -1,11 +1,11 @@ // Copyright 2016 Documize Inc. . All rights reserved. // -// This software (Documize Community Edition) is licensed under +// This software (Documize Community Edition) is licensed under // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html // // You can operate outside the AGPL restrictions by purchasing // Documize Enterprise Edition and obtaining a commercial license -// by contacting . +// by contacting . // // https://documize.com