Unittesting begins

This commit is contained in:
Bel LaPointe
2019-11-12 13:45:32 -07:00
commit 8c4bc81694
35 changed files with 3231 additions and 0 deletions

45
config/config.go Executable file
View File

@@ -0,0 +1,45 @@
package config
import (
"fmt"
"local/args"
"os"
"strings"
)
var (
Port string
StoreType string
StoreAddr string
StoreUser string
StorePass string
Public string
)
func init() {
Refresh()
}
func Refresh() {
if strings.Contains(fmt.Sprint(os.Args), "-test") {
return
}
as := args.NewArgSet()
as.Append(args.STRING, "port", "port to listen on", "39909")
as.Append(args.STRING, "store", "type of store", "map")
as.Append(args.STRING, "storeaddr", "addr of store", "")
as.Append(args.STRING, "storeuser", "user of store", "")
as.Append(args.STRING, "storepass", "pass of store", "")
as.Append(args.STRING, "public", "url of php server", "http://localhost:38808")
if err := as.Parse(); err != nil {
panic(err)
}
Port = ":" + strings.TrimPrefix(as.Get("port").GetString(), ":")
StoreType = as.Get("store").GetString()
StoreAddr = as.Get("storeaddr").GetString()
StoreUser = as.Get("storeuser").GetString()
StorePass = as.Get("storepass").GetString()
Public = as.Get("public").GetString()
}