Exemple #1
0
func init() {
	dbPath := fmt.Sprintf("%s/data/bolt.db", cfg.RootDir())
	cfg.GetLogger().Debug("Initializing storage", "path", dbPath)
	os.MkdirAll(path.Dir(dbPath), 0755)

	var err error
	if db, err = bolt.Open(dbPath, 0644, nil); err != nil {
		panic(err)
	}
}
Exemple #2
0
func render(c *gin.Context, template string, ctx map[string]interface{}) {
	config := cfg.GetConfig()

	ctx["instance_id"] = cfg.InstanceId()
	ctx["url_path"] = c.Request.URL.Path
	ctx["date_format"] = config.Ui.DateFormat

	c.Set("template", fmt.Sprintf("%s/templates/%s/%s", cfg.RootDir(), config.Ui.Theme, template))
	c.Set("data", ctx)
	c.Writer.WriteHeader(http.StatusOK)
}