func New() Handler { h := new(Handler) h.articles = articles.New() h.ItoArticle = baseArticle // URLs, Paths h.MediaURL = config.RequiredGroupString("articles", "mediaURL") h.BasePath = config.RequiredGroupString("articles", "basePath") h.ImagePath = config.RequiredGroupString("articles", "imagePath") // Templates h.Templates = map[string]string{ "list": "/articles/articles.html", "view": "/articles/article.html", "create": "/articles/create.html", "edit": "/articles/edit.html", } // Page count h.PageCount = 30 if c, ok := config.GroupInt("articles", "pageCount"); ok { h.PageCount = c } return *h }
func setInt(group, key string, i *int) { if v, ok := config.GroupInt(group, key); ok { *i = v } }