mirror of
https://github.com/safing/portbase
synced 2026-04-28 11:50:02 +00:00
Continue work on database module
This commit is contained in:
parent
7ad09b60c1
commit
b8e7f90dbe
25 changed files with 962 additions and 1073 deletions
29
database/dbmodule/db.go
Normal file
29
database/dbmodule/db.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package dbmodule
|
||||
|
||||
import (
|
||||
"github.com/Safing/portbase/database"
|
||||
)
|
||||
|
||||
var (
|
||||
databaseDir string
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&databaseDir, "db", "", "set database directory")
|
||||
|
||||
modules.Register("database", prep, start, stop)
|
||||
}
|
||||
|
||||
func prep() error {
|
||||
if databaseDir == "" {
|
||||
return errors.New("no database location specified, set with `-db=/path/to/db`")
|
||||
}
|
||||
}
|
||||
|
||||
func start() error {
|
||||
return database.Initialize(databaseDir)
|
||||
}
|
||||
|
||||
func stop() {
|
||||
return database.Shutdown()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue