1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Writes database in current directory

Former-commit-id: 23f641ab0f9e7591cd9729355a7083209d50edff [formerly 13cfdb07137c97b1097995d967a20943d1887aa0] [formerly 9a3ef830e58617e341ce2a6f9e40f97f94caec41 [formerly 9f6d0a48ea4f78404233b971aeff7543458e51b6 [formerly 3c53546c48]]]
Former-commit-id: 4bab77f43c3aab85275c144e165d6fc6bb34d3ec [formerly 865f60e97d5fc21db125d28410257514e748b063]
Former-commit-id: 3b7858054d1887c8ab2cccdfeaf4cd0b0bad4c7e
Former-commit-id: a1c5ab12da
This commit is contained in:
Zack Scholl 2016-02-15 17:11:07 -05:00
parent 32d0d2ca6c
commit 652d1125e1

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log" "log"
"os"
"path" "path"
"runtime" "runtime"
@ -38,7 +39,8 @@ var VersionNum string
func main() { func main() {
VersionNum = "1.1" VersionNum = "1.1"
_, executableFile, _, _ := runtime.Caller(0) // get full path of this file _, executableFile, _, _ := runtime.Caller(0) // get full path of this file
databaseFile := path.Join(path.Dir(executableFile), "data.db") cwd, _ := os.Getwd()
databaseFile := path.Join(cwd, "data.db")
flag.StringVar(&RuntimeArgs.Port, "p", ":8003", "port to bind") flag.StringVar(&RuntimeArgs.Port, "p", ":8003", "port to bind")
flag.StringVar(&RuntimeArgs.DatabaseLocation, "db", databaseFile, "location of database file") flag.StringVar(&RuntimeArgs.DatabaseLocation, "db", databaseFile, "location of database file")
flag.StringVar(&RuntimeArgs.AdminKey, "a", RandStringBytesMaskImprSrc(50), "key to access admin priveleges") flag.StringVar(&RuntimeArgs.AdminKey, "a", RandStringBytesMaskImprSrc(50), "key to access admin priveleges")