mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Fixup: Debug mode broken
This commit is contained in:
parent
180a28cda6
commit
a976007642
3
main.go
3
main.go
@ -13,7 +13,6 @@ import (
|
||||
)
|
||||
|
||||
var version string
|
||||
var hotTemplateReloading bool
|
||||
var pathToData string
|
||||
|
||||
func main() {
|
||||
@ -23,7 +22,6 @@ func main() {
|
||||
app.Version = version
|
||||
app.Compiled = time.Now()
|
||||
app.Action = func(c *cli.Context) error {
|
||||
|
||||
pathToData = c.GlobalString("data")
|
||||
os.MkdirAll(pathToData, 0755)
|
||||
host := c.GlobalString("host")
|
||||
@ -57,7 +55,6 @@ func main() {
|
||||
c.GlobalString("cookie-secret"),
|
||||
c.GlobalString("access-code"),
|
||||
c.GlobalBool("allow-insecure-markup"),
|
||||
hotTemplateReloading,
|
||||
c.GlobalBool("allow-file-uploads"),
|
||||
c.GlobalUint("max-upload-mb"),
|
||||
logger(c.GlobalBool("debug")),
|
||||
|
@ -35,7 +35,6 @@ type Site struct {
|
||||
SessionStore sessions.Store
|
||||
SecretCode string
|
||||
AllowInsecure bool
|
||||
HotTemplateReloading bool
|
||||
Fileuploads bool
|
||||
MaxUploadSize uint
|
||||
Logger *lumber.ConsoleLogger
|
||||
@ -51,6 +50,8 @@ func (s *Site) defaultLock() string {
|
||||
return HashPassword(s.DefaultPassword)
|
||||
}
|
||||
|
||||
var hotTemplateReloading bool
|
||||
|
||||
func Serve(
|
||||
filepathToData,
|
||||
host,
|
||||
@ -66,7 +67,6 @@ func Serve(
|
||||
secret string,
|
||||
secretCode string,
|
||||
allowInsecure bool,
|
||||
hotTemplateReloading bool,
|
||||
fileuploads bool,
|
||||
maxUploadSize uint,
|
||||
logger *lumber.ConsoleLogger,
|
||||
@ -93,7 +93,6 @@ func Serve(
|
||||
sessions.NewCookieStore([]byte(secret)),
|
||||
secretCode,
|
||||
allowInsecure,
|
||||
hotTemplateReloading,
|
||||
fileuploads,
|
||||
maxUploadSize,
|
||||
logger,
|
||||
@ -113,7 +112,7 @@ func (s Site) Router() *gin.Engine {
|
||||
s.Logger = lumber.NewConsoleLogger(lumber.TRACE)
|
||||
}
|
||||
|
||||
if s.HotTemplateReloading {
|
||||
if hotTemplateReloading {
|
||||
gin.SetMode(gin.DebugMode)
|
||||
} else {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
@ -124,7 +123,7 @@ func (s Site) Router() *gin.Engine {
|
||||
"sniffContentType": s.sniffContentType,
|
||||
})
|
||||
|
||||
if s.HotTemplateReloading {
|
||||
if hotTemplateReloading {
|
||||
router.LoadHTMLGlob("templates/*.tmpl")
|
||||
} else {
|
||||
router.HTMLRender = s.loadTemplates("index.tmpl")
|
||||
|
Loading…
Reference in New Issue
Block a user