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

71 lines
1.9 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"
"os"
2017-07-19 18:47:01 +01:00
"github.com/documize/community/core/env"
"github.com/documize/community/domain"
2017-07-21 13:39:53 +01:00
"github.com/documize/community/domain/section"
"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
rt.Product = domain.Product{}
2019-01-08 17:47:26 +00:00
rt.Product.Major = "2"
rt.Product.Minor = "4"
rt.Product.Patch = "0"
rt.Product.Revision = "190419131243"
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 = domain.CommunityEdition
2017-07-21 13:39:53 +01:00
rt.Product.Title = fmt.Sprintf("%s Edition", rt.Product.Edition)
2017-07-19 18:47:01 +01:00
2018-10-29 16:53:54 +00:00
// Setup data store.
s := store.Store{}
2017-07-26 10:50:26 +01:00
2018-11-11 16:54:47 +00:00
// Parse flags/envars.
flagsOK := false
rt.Flags, flagsOK = env.ParseFlags()
if !flagsOK {
os.Exit(0)
}
bootOK := boot.InitRuntime(&rt, &s)
if bootOK {
2017-07-20 10:48:27 +01:00
// 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
}