added support for config files, openbsd, pledge and unveil

This commit is contained in:
ston1th 2018-10-26 17:28:50 +02:00
commit 375933c7bc
14 changed files with 138 additions and 49 deletions

View file

@ -3,6 +3,7 @@
package db
import (
"git.giftfish.de/ston1th/godrop/v2"
"git.giftfish.de/ston1th/gowiki/pkg/cache"
"git.giftfish.de/ston1th/gowiki/pkg/core"
"git.giftfish.de/ston1th/gowiki/pkg/index"
@ -32,7 +33,12 @@ type DB struct {
func New(dir string) (db *DB, err error) {
db = &DB{cache: cache.NewCache()}
db.store, err = store.NewBoltStore(filepath.Join(dir, storeFile), nil)
dbFile := filepath.Join(dir, storeFile)
err = godrop.Unveil(dbFile, "rwc")
if err != nil {
return
}
db.store, err = store.NewBoltStore(dbFile, nil)
if err != nil {
return
}

View file

@ -79,7 +79,6 @@ func (db *DB) CreatePage(title, section, markdown, username string, p core.Permi
}
st := render.StoreTitle(section, render.Title(title))
_, err = db.getPage(st, username)
//if err == nil || (err != nil && err != store.ErrKeyNotFound) {
if err != store.ErrKeyNotFound {
return
}