1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09:42 +02:00
documize/edition/community.go

70 lines
2 KiB
Go
Raw Normal View History

2017-07-19 18:47:01 +01:00
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
//
// 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 <sales@documize.com>.
//
// https://documize.com
// This package provides Documize as a single executable.
package main
import (
"fmt"
"github.com/documize/community/core/api"
"github.com/documize/community/core/api/request"
"github.com/documize/community/core/env"
2017-07-21 13:39:53 +01:00
"github.com/documize/community/domain/section"
2017-07-20 12:30:03 +01:00
"github.com/documize/community/edition/boot"
2017-07-19 18:47:01 +01:00
"github.com/documize/community/edition/logging"
_ "github.com/documize/community/embed" // the compressed front-end code and static data
2017-07-21 18:14:19 +01:00
"github.com/documize/community/server"
_ "github.com/go-sql-driver/mysql" // the mysql driver is required behind the scenes
2017-07-19 18:47:01 +01:00
)
2017-07-21 13:39:53 +01:00
var rt env.Runtime
func main() {
2017-07-19 18:47:01 +01:00
// runtime stores server/application level information
2017-07-21 13:39:53 +01:00
rt := env.Runtime{}
2017-07-19 18:47:01 +01:00
// wire up logging implementation
2017-07-21 13:39:53 +01:00
rt.Log = logging.NewLogger()
2017-07-19 18:47:01 +01:00
// define product edition details
2017-07-21 13:39:53 +01:00
rt.Product = env.ProdInfo{}
rt.Product.Major = "1"
rt.Product.Minor = "50"
rt.Product.Patch = "2"
rt.Product.Version = fmt.Sprintf("%s.%s.%s", rt.Product.Major, rt.Product.Minor, rt.Product.Patch)
rt.Product.Edition = "Community"
rt.Product.Title = fmt.Sprintf("%s Edition", rt.Product.Edition)
rt.Product.License = env.License{}
rt.Product.License.Seats = 1
rt.Product.License.Valid = true
rt.Product.License.Trial = false
rt.Product.License.Edition = "Community"
2017-07-19 18:47:01 +01:00
2017-07-20 10:48:27 +01:00
// parse settings from command line and environment
2017-07-21 13:39:53 +01:00
rt.Flags = env.ParseFlags()
flagsOK := boot.InitRuntime(&rt)
2017-07-20 10:48:27 +01:00
if flagsOK {
// runtime.Log = runtime.Log.SetDB(runtime.Db)
}
2017-07-19 18:47:01 +01:00
// temp code repair
2017-07-21 13:39:53 +01:00
api.Runtime = rt
request.Db = rt.Db
2017-07-19 18:47:01 +01:00
2017-07-21 14:11:57 +01:00
// Register smart sections
2017-07-21 13:39:53 +01:00
section.Register(rt)
2017-07-19 18:47:01 +01:00
2017-07-21 14:11:57 +01:00
ready := make(chan struct{}, 1) // channel signals router ready
2017-07-21 18:14:19 +01:00
server.Start(rt, ready)
2017-07-19 18:47:01 +01:00
}