-
Notifications
You must be signed in to change notification settings - Fork 20
/
monet.go
50 lines (39 loc) · 1.06 KB
/
monet.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"fmt"
"reflect"
"github.com/hoisie/web"
"github.com/jmoiron/monet/blog"
"github.com/jmoiron/monet/conf"
"github.com/jmoiron/monet/db"
"github.com/jmoiron/monet/template"
// apps
"github.com/jmoiron/monet/app"
"github.com/jmoiron/monet/gallery"
)
func main() {
fmt.Printf("Using config %s\n", conf.Path)
fmt.Printf("Using models:\n")
for _, m := range db.Models {
t := reflect.TypeOf(m)
fmt.Printf(" %s\n", fmt.Sprintf("%s", t)[1:])
}
template.Init(conf.Config.TemplatePaths)
fmt.Printf(conf.Config.String())
web.Config.StaticDir = conf.Config.StaticPath
db.Connect(conf.Config.DbHostString(), conf.Config.DbName)
db.RegisterAllIndexes()
blog.AttachAdmin("/admin/")
blog.Attach("/")
app.AttachAdmin("/admin/")
app.Attach("/")
gallery.AttachAdmin("/admin/")
gallery.Attach("/")
web.Get("/$", blog.Index)
web.Get("/(.*)", blog.Flatpage)
app.AddPanel(&blog.PostPanel{})
app.AddPanel(&blog.UnpublishedPanel{})
app.AddPanel(&blog.PagesPanel{})
app.AddPanel(&gallery.GalleryPanel{})
web.Run(conf.Config.HostString())
}