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

82 lines
2.1 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 (
2021-08-18 19:39:51 -04:00
"embed"
2017-07-19 18:47:01 +01:00
"fmt"
"os"
2017-07-19 18:47:01 +01:00
"github.com/documize/community/core/env"
2022-03-16 13:32:48 -04:00
"github.com/documize/community/core/i18n"
"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-07-21 18:14:19 +01:00
"github.com/documize/community/server"
2017-07-19 18:47:01 +01:00
)
2021-08-18 19:39:51 -04:00
//go:embed static/*
var embeddedFiles embed.FS
2017-07-21 13:39:53 +01:00
func main() {
// Runtime stores server/application 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
// Specify the product edition.
rt.Product = domain.Product{}
2022-03-19 18:07:38 -04:00
rt.Product.Major = "5"
2024-12-31 13:09:30 -05:00
rt.Product.Minor = "13"
2024-06-18 11:53:23 -04:00
rt.Product.Patch = "0"
2024-12-31 13:09:30 -05:00
rt.Product.Revision = "1735665467719"
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
2021-11-03 11:46:20 -04:00
rt.Product.Title = "Community"
2017-07-19 18:47:01 +01:00
2021-11-03 11:46:20 -04:00
rt.Log.Info(fmt.Sprintf("Documize %s v%s (build %s)", rt.Product.Title, rt.Product.Version, rt.Product.Revision))
2019-11-15 18:21:56 +00:00
2021-08-18 19:39:51 -04:00
// Locate static assets.
rt.Assets = embeddedFiles
2018-10-29 16:53:54 +00:00
// Setup data store.
s := store.Store{}
2017-07-26 10:50:26 +01:00
// Parse configuration information.
flagsOK := false
rt.Flags, flagsOK = env.LoadConfig()
if !flagsOK {
os.Exit(0)
}
rt.Log.Info("Configuration: " + rt.Flags.ConfigSource)
2022-03-16 13:32:48 -04:00
// i18n
err := i18n.Initialize(rt.Assets)
if err != nil {
rt.Log.Error("i18n", err)
}
// Start database init.
2021-08-18 19:39:51 -04:00
boot.InitRuntime(&rt, &s)
2017-07-19 18:47:01 +01:00
// Register document sections.
2017-08-02 15:26:31 +01:00
section.Register(&rt, &s)
2017-07-19 18:47:01 +01:00
// Start web server.
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
}