1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 03:55:24 +02:00

refactored routing/web serving logic

This commit is contained in:
Harvey Kandola 2017-07-21 18:14:19 +01:00
parent 76d77bef9b
commit d888962082
16 changed files with 410 additions and 382 deletions

View file

@ -19,7 +19,7 @@ import (
"github.com/documize/community/core/database"
"github.com/documize/community/core/env"
"github.com/documize/community/core/secrets"
"github.com/documize/community/core/web"
"github.com/documize/community/server/web"
"github.com/jmoiron/sqlx"
)
@ -68,7 +68,7 @@ func InitRuntime(r *env.Runtime) bool {
// 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 {
if err := database.Migrate(*r, true /* the config table exists */); err != nil {
r.Log.Error("unable to run database migration", err)
return false
}

View file

@ -16,14 +16,14 @@ import (
"fmt"
"github.com/documize/community/core/api"
"github.com/documize/community/core/api/endpoint"
"github.com/documize/community/core/api/request"
"github.com/documize/community/core/env"
"github.com/documize/community/domain/section"
"github.com/documize/community/edition/boot"
"github.com/documize/community/edition/logging"
_ "github.com/documize/community/embed" // the compressed front-end code and static data
_ "github.com/go-sql-driver/mysql" // the mysql driver is required behind the scenes
"github.com/documize/community/server"
_ "github.com/go-sql-driver/mysql" // the mysql driver is required behind the scenes
)
var rt env.Runtime
@ -65,5 +65,5 @@ func main() {
section.Register(rt)
ready := make(chan struct{}, 1) // channel signals router ready
endpoint.Serve(rt, ready)
server.Start(rt, ready)
}