mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-18 15:08:20 +00:00
8bb2f0871a
(cherry picked from commitb7fe7cf401
) (cherry picked from commitcf339eed4f
) (cherry picked from commit4f3a16168b
) (cherry picked from commit6f5bbc53fc
) (cherry picked from commitaca42b422e
) (cherry picked from commit5a7f7580e5
) (cherry picked from commit06c383c807
) (cherry picked from commitfe831dcb53
) (cherry picked from commitcd12cd0dbc
) (cherry picked from commitcc79163703
) (cherry picked from commit0102a5715e
) (cherry picked from commit403f7520b3
) (cherry picked from commita3b61510a2
) (cherry picked from commitf83f0f9feb
) (cherry picked from commitfd1c3a6d09
) (cherry picked from commitf7cdc3d6f1
) (cherry picked from commit060121b644
) (cherry picked from commit62c847ff02
) (cherry picked from commit4d051b51c2
) (cherry picked from commit86e6981a93
) (cherry picked from commitc1fc9e441b
)
64 lines
1.6 KiB
Go
64 lines
1.6 KiB
Go
// Copyright 2014 The Gogs Authors. All rights reserved.
|
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"runtime"
|
|
"strings"
|
|
"time"
|
|
|
|
"code.gitea.io/gitea/cmd"
|
|
"code.gitea.io/gitea/modules/log"
|
|
"code.gitea.io/gitea/modules/setting"
|
|
|
|
// register supported doc types
|
|
_ "code.gitea.io/gitea/modules/markup/asciicast"
|
|
_ "code.gitea.io/gitea/modules/markup/console"
|
|
_ "code.gitea.io/gitea/modules/markup/csv"
|
|
_ "code.gitea.io/gitea/modules/markup/markdown"
|
|
_ "code.gitea.io/gitea/modules/markup/orgmode"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// these flags will be set by the build flags
|
|
var (
|
|
Version = "development" // program version for this build
|
|
Tags = "" // the Golang build tags
|
|
MakeVersion = "" // "make" program version if built with make
|
|
)
|
|
|
|
var ForgejoVersion = "1.0.0"
|
|
|
|
func init() {
|
|
setting.AppVer = Version
|
|
setting.ForgejoVersion = ForgejoVersion
|
|
setting.AppBuiltWith = formatBuiltWith()
|
|
setting.AppStartTime = time.Now().UTC()
|
|
}
|
|
|
|
func main() {
|
|
cli.OsExiter = func(code int) {
|
|
log.GetManager().Close()
|
|
os.Exit(code)
|
|
}
|
|
app := cmd.NewMainApp(Version, formatBuiltWith())
|
|
_ = cmd.RunMainApp(app, os.Args...) // all errors should have been handled by the RunMainApp
|
|
log.GetManager().Close()
|
|
}
|
|
|
|
func formatBuiltWith() string {
|
|
version := runtime.Version()
|
|
if len(MakeVersion) > 0 {
|
|
version = MakeVersion + ", " + runtime.Version()
|
|
}
|
|
if len(Tags) == 0 {
|
|
return " built with " + version
|
|
}
|
|
|
|
return " built with " + version + " : " + strings.ReplaceAll(Tags, " ", ", ")
|
|
}
|