1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

refactored flag/env loading

This commit is contained in:
Harvey Kandola 2017-07-19 18:47:01 +01:00
parent dc49dbbeff
commit 68130122e7
23 changed files with 1128 additions and 909 deletions

View file

@ -16,12 +16,12 @@ import (
"html/template"
"net/http"
"github.com/documize/community/core/env"
"github.com/documize/community/core/api"
"github.com/documize/community/core/secrets"
)
// SiteMode defines that the web server should show the system to be in a particular state.
var SiteMode string
// var SiteMode string
const (
// SiteModeNormal serves app
@ -40,8 +40,8 @@ var SiteInfo struct {
}
func init() {
env.GetString(&SiteMode, "offline", false, "set to '1' for OFFLINE mode", nil) // no sense overriding this setting from the DB
SiteInfo.DBhash = secrets.GenerateRandomPassword() // do this only once
// env.GetString(&SiteMode, "offline", false, "set to '1' for OFFLINE mode", nil) // no sense overriding this setting from the DB
SiteInfo.DBhash = secrets.GenerateRandomPassword() // do this only once
}
// EmbedHandler is defined in each embed directory
@ -57,7 +57,7 @@ var Embed EmbedHandler
// EmberHandler provides the webserver for pages developed using the Ember programming environment.
func EmberHandler(w http.ResponseWriter, r *http.Request) {
filename := "index.html"
switch SiteMode {
switch api.Runtime.Flags.SiteMode {
case SiteModeOffline:
filename = "offline.html"
case SiteModeSetup: