Store sisyphus.db in Maildir

master
Carlo Strub 7 years ago
parent 754eac57b1
commit 3bc9beb113

@ -5,11 +5,11 @@ import (
)
// openDB creates and opens a new database and its respective buckets (if required)
func openDB(path string) (db *bolt.DB, err error) {
func openDB(maildir string) (db *bolt.DB, err error) {
// Open the sisyphus.db data file in your current directory.
// It will be created if it doesn't exist.
db, err = bolt.Open(path, 0600, nil)
db, err = bolt.Open(maildir+"/sisyphus.db", 0600, nil)
if err != nil {
return db, err
}

@ -20,7 +20,7 @@ func main() {
panic(err)
}
var maildir, database *string
var maildir *string
// Define App
app := cli.NewApp()
@ -46,12 +46,6 @@ func main() {
Usage: "Path to the Maildir directory",
Destination: maildir,
},
cli.StringFlag{
Name: "database",
Value: wd + "/sisyphus.db",
Usage: "Path to the sisyphus database",
Destination: database,
},
}
app.Commands = []cli.Command{
@ -60,9 +54,6 @@ func main() {
Aliases: []string{"s"},
Usage: "start sisyphus daemon",
Action: func(c *cli.Context) error {
if database == nil {
return errors.New("no database selected")
}
if maildir == nil {
return errors.New("no maildir selected")
}
@ -76,7 +67,7 @@ func main() {
fmt.Println(mails)
// Open the database
db, err := openDB(*database)
db, err := openDB(*maildir)
if err != nil {
return cli.NewExitError(err, 66)
}

Loading…
Cancel
Save