mirror of
https://github.com/documize/community.git
synced 2025-07-20 05:39:42 +02:00
setup mode message & license change callback params
This commit is contained in:
parent
4b24cbc686
commit
888569d070
2 changed files with 23 additions and 7 deletions
|
@ -148,33 +148,37 @@ func (h *Handler) SetLicense(w http.ResponseWriter, r *http.Request) {
|
|||
lj := licenseJSON{}
|
||||
x := licenseXML{Key: "", Signature: ""}
|
||||
|
||||
err = xml.Unmarshal([]byte(config), &x)
|
||||
if err == nil {
|
||||
err1 := xml.Unmarshal([]byte(config), &x)
|
||||
if err1 == nil {
|
||||
lj.Key = x.Key
|
||||
lj.Signature = x.Signature
|
||||
} else {
|
||||
h.Runtime.Log.Error("failed to XML unmarshal EDITION-LICENSE", err)
|
||||
}
|
||||
|
||||
j, err := json.Marshal(lj)
|
||||
j, err2 := json.Marshal(lj)
|
||||
js := "{}"
|
||||
if err == nil {
|
||||
if err2 == nil {
|
||||
js = string(j)
|
||||
} else {
|
||||
h.Runtime.Log.Error("failed to JSON marshal EDITION-LICENSE", err2)
|
||||
}
|
||||
|
||||
h.Store.Setting.Set("EDITION-LICENSE", js)
|
||||
|
||||
event.Handler().Publish(string(event.TypeSystemLicenseChange))
|
||||
|
||||
ctx.Transaction, err = h.Runtime.Db.Beginx()
|
||||
if err != nil {
|
||||
response.WriteServerError(w, method, err)
|
||||
return
|
||||
}
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeSystemLicense)
|
||||
ctx.Transaction.Commit()
|
||||
|
||||
h.Runtime.Log.Info("License changed")
|
||||
event.Handler().Publish(string(event.TypeSystemLicenseChange), h.Runtime, h.Store)
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeSystemLicense)
|
||||
|
||||
response.WriteEmpty(w)
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,12 @@ func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
|
|||
// start server
|
||||
if !rt.Flags.SSLEnabled() {
|
||||
rt.Log.Info("Starting non-SSL server on " + rt.Flags.HTTPPort)
|
||||
if rt.Flags.SiteMode == env.SiteModeSetup {
|
||||
rt.Log.Info("***")
|
||||
rt.Log.Info(fmt.Sprintf("*** Go to http://localhost:%s/setup in your web browser and complete setup wizard ***", rt.Flags.HTTPPort))
|
||||
rt.Log.Info("***")
|
||||
}
|
||||
|
||||
n.Run(testHost + ":" + rt.Flags.HTTPPort)
|
||||
} else {
|
||||
if rt.Flags.ForceHTTPPort2SSL != "" {
|
||||
|
@ -109,6 +115,12 @@ func Start(rt *env.Runtime, s *domain.Store, ready chan struct{}) {
|
|||
}()
|
||||
}
|
||||
|
||||
if rt.Flags.SiteMode == env.SiteModeSetup {
|
||||
rt.Log.Info("***")
|
||||
rt.Log.Info(fmt.Sprintf("*** Go to https://localhost:%s/setup in your web browser and complete setup wizard ***", rt.Flags.HTTPPort))
|
||||
rt.Log.Info("***")
|
||||
}
|
||||
|
||||
rt.Log.Info("Starting SSL server on " + rt.Flags.HTTPPort + " with " + rt.Flags.SSLCertFile + " " + rt.Flags.SSLKeyFile)
|
||||
|
||||
// TODO: https://blog.gopheracademy.com/advent-2016/exposing-go-on-the-internet/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue