Check unhandled errors (#128)
parent
24d7bae2b2
commit
31da225309
3
main.go
3
main.go
|
@ -8,6 +8,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
|
@ -38,5 +39,5 @@ func main() {
|
||||||
cmd.CmdAdmin,
|
cmd.CmdAdmin,
|
||||||
}
|
}
|
||||||
app.Flags = append(app.Flags, []cli.Flag{}...)
|
app.Flags = append(app.Flags, []cli.Flag{}...)
|
||||||
app.Run(os.Args)
|
log.Fatal(app.Run(os.Args))
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,7 +345,12 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
cfg.Section("security").Key("INSTALL_LOCK").SetValue("true")
|
cfg.Section("security").Key("INSTALL_LOCK").SetValue("true")
|
||||||
cfg.Section("security").Key("SECRET_KEY").SetValue(base.GetRandomString(15))
|
cfg.Section("security").Key("SECRET_KEY").SetValue(base.GetRandomString(15))
|
||||||
|
|
||||||
os.MkdirAll(filepath.Dir(setting.CustomConf), os.ModePerm)
|
err := os.MkdirAll(filepath.Dir(setting.CustomConf), os.ModePerm)
|
||||||
|
if err != nil {
|
||||||
|
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := cfg.SaveTo(setting.CustomConf); err != nil {
|
if err := cfg.SaveTo(setting.CustomConf); err != nil {
|
||||||
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form)
|
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form)
|
||||||
return
|
return
|
||||||
|
@ -375,8 +380,14 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-login for admin
|
// Auto-login for admin
|
||||||
ctx.Session.Set("uid", u.ID)
|
if err := ctx.Session.Set("uid", u.ID); err != nil {
|
||||||
ctx.Session.Set("uname", u.Name)
|
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err := ctx.Session.Set("uname", u.Name); err != nil {
|
||||||
|
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), INSTALL, &form)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("First-time run install finished!")
|
log.Info("First-time run install finished!")
|
||||||
|
|
Loading…
Reference in New Issue