mirror of
https://github.com/documize/community.git
synced 2025-07-23 15:19:42 +02:00
expose Product edition details
This commit is contained in:
parent
772aeff93d
commit
4dbe2804a1
2 changed files with 1176 additions and 1128 deletions
|
@ -28,10 +28,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var port, certFile, keyFile, forcePort2SSL string
|
var port, certFile, keyFile, forcePort2SSL string
|
||||||
var product core.ProdInfo
|
var Product core.ProdInfo
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
product = core.Product()
|
Product = core.Product()
|
||||||
environment.GetString(&certFile, "cert", false, "the cert.pem file used for https", nil)
|
environment.GetString(&certFile, "cert", false, "the cert.pem file used for https", nil)
|
||||||
environment.GetString(&keyFile, "key", false, "the key.pem file used for https", nil)
|
environment.GetString(&keyFile, "key", false, "the key.pem file used for https", nil)
|
||||||
environment.GetString(&port, "port", false, "http/https port number", nil)
|
environment.GetString(&port, "port", false, "http/https port number", nil)
|
||||||
|
@ -49,7 +49,7 @@ func Serve(ready chan struct{}) {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info(fmt.Sprintf("Starting %s version %s", product.Title, product.Version))
|
log.Info(fmt.Sprintf("Starting %s version %s", Product.Title, Product.Version))
|
||||||
|
|
||||||
switch web.SiteMode {
|
switch web.SiteMode {
|
||||||
case web.SiteModeOffline:
|
case web.SiteModeOffline:
|
||||||
|
@ -146,7 +146,7 @@ func cors(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
|
||||||
|
|
||||||
func metrics(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
|
func metrics(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
|
||||||
|
|
||||||
w.Header().Add("X-Documize-Version", product.Version)
|
w.Header().Add("X-Documize-Version", Product.Version)
|
||||||
w.Header().Add("Cache-Control", "no-cache")
|
w.Header().Add("Cache-Control", "no-cache")
|
||||||
|
|
||||||
// Prevent page from being displayed in an iframe
|
// Prevent page from being displayed in an iframe
|
||||||
|
@ -161,7 +161,7 @@ func metrics(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func version(w http.ResponseWriter, r *http.Request) {
|
func version(w http.ResponseWriter, r *http.Request) {
|
||||||
if _, err := w.Write([]byte(product.Version)); err != nil {
|
if _, err := w.Write([]byte(Product.Version)); err != nil {
|
||||||
log.Error("versionHandler", err)
|
log.Error("versionHandler", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue