Update readme, store data in homedir/.name_pending instead the cwd, move client build output back to client/dist
This commit is contained in:
parent
891f7b2f10
commit
65229f7a9e
4 changed files with 199 additions and 172 deletions
|
@ -1,13 +1,27 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
)
|
||||
|
||||
var db *bolt.DB
|
||||
|
||||
func init() {
|
||||
db, _ = bolt.Open("data.db", 0600, nil)
|
||||
var err error
|
||||
currentUser, _ := user.Current()
|
||||
appDir := path.Join(currentUser.HomeDir, ".name_pending")
|
||||
|
||||
os.Mkdir(appDir, 0777)
|
||||
|
||||
db, err = bolt.Open(path.Join(appDir, "data.db"), 0600, nil)
|
||||
if err != nil {
|
||||
log.Fatal("Unable to open database file")
|
||||
}
|
||||
|
||||
db.Update(func(tx *bolt.Tx) error {
|
||||
tx.CreateBucketIfNotExists([]byte("Users"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue