mirror of
https://github.com/safing/portbase
synced 2025-09-01 18:19:57 +00:00
29 lines
481 B
Go
29 lines
481 B
Go
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()
|
|
}
|