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/env"
|
2017-07-21 13:39:53 +01:00
|
|
|
"github.com/documize/community/domain/section"
|
2018-09-27 15:14:48 +01:00
|
|
|
"github.com/documize/community/domain/store"
|
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"
|
2017-09-01 14:11:09 +01:00
|
|
|
"github.com/documize/community/embed"
|
2017-07-21 18:14:19 +01:00
|
|
|
"github.com/documize/community/server"
|
2017-09-01 14:11:09 +01:00
|
|
|
"github.com/documize/community/server/web"
|
2017-07-19 18:47:01 +01:00
|
|
|
)
|
|
|
|
|
2017-07-21 13:39:53 +01:00
|
|
|
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
|
2018-01-10 16:07:17 +00:00
|
|
|
rt.Log = logging.NewLogger(false)
|
2017-07-19 18:47:01 +01:00
|
|
|
|
2017-09-01 14:11:09 +01:00
|
|
|
// wire up embedded web assets handler
|
|
|
|
web.Embed = embed.NewEmbedder()
|
|
|
|
|
2017-07-21 18:21:34 +01:00
|
|
|
// product details
|
2017-07-21 13:39:53 +01:00
|
|
|
rt.Product = env.ProdInfo{}
|
|
|
|
rt.Product.Major = "1"
|
2018-10-01 18:23:47 +01:00
|
|
|
rt.Product.Minor = "71"
|
2018-09-04 17:44:40 +01:00
|
|
|
rt.Product.Patch = "0"
|
2018-10-06 17:23:55 +01:00
|
|
|
rt.Product.Revision = 181006150624
|
2017-07-21 13:39:53 +01:00
|
|
|
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-26 10:50:26 +01:00
|
|
|
// setup store
|
2018-09-27 15:14:48 +01:00
|
|
|
s := store.Store{}
|
2017-07-26 10:50:26 +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()
|
2017-07-26 10:50:26 +01:00
|
|
|
flagsOK := boot.InitRuntime(&rt, &s)
|
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
|
|
|
|
2017-07-21 14:11:57 +01:00
|
|
|
// Register smart sections
|
2017-08-02 15:26:31 +01:00
|
|
|
section.Register(&rt, &s)
|
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-26 10:50:26 +01:00
|
|
|
server.Start(&rt, &s, ready)
|
2017-07-19 18:47:01 +01:00
|
|
|
}
|