Remove caddy simulation
This commit is contained in:
parent
8d6102c58f
commit
d0958d2366
3 changed files with 12 additions and 25 deletions
13
main.go
13
main.go
|
@ -23,7 +23,6 @@ func main() {
|
|||
user := flag.String("user", "", "Username to register")
|
||||
keyPath := flag.String("key", "", "Path to the private key (client mode) or public key (registration mode) to use")
|
||||
baseUrlString := flag.String("base-url", "http://localhost:8080", "Base URL of the server")
|
||||
simulateCaddy := flag.Bool("caddy", false, "Simulate caddy reverse proxy")
|
||||
useTempDb := flag.Bool("temp-db", false, "Use a temporary in-memory database")
|
||||
dbPath := flag.String("db", "", "Path to the sqlite database file")
|
||||
|
||||
|
@ -42,7 +41,7 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
runClient(baseUrl, *keyPath, *keyId, *simulateCaddy)
|
||||
runClient(baseUrl, *keyPath, *keyId)
|
||||
} else if *register {
|
||||
if *keyPath == "" || *user == "" {
|
||||
flag.PrintDefaults()
|
||||
|
@ -56,11 +55,11 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
runServer(*simulateCaddy, *useTempDb, *dbPath)
|
||||
runServer(*useTempDb, *dbPath)
|
||||
}
|
||||
}
|
||||
|
||||
func runClient(baseUrl *url.URL, keyFile string, keyId string, simulateCaddy bool) {
|
||||
func runClient(baseUrl *url.URL, keyFile string, keyId string) {
|
||||
testData := map[string]string{"hello": "world"}
|
||||
json_data, _ := json.Marshal(testData)
|
||||
|
||||
|
@ -70,7 +69,7 @@ func runClient(baseUrl *url.URL, keyFile string, keyId string, simulateCaddy boo
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
resp, err := client.Post(baseUrl, key, keyId, json_data, simulateCaddy)
|
||||
resp, err := client.Post(baseUrl, key, keyId, json_data)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -117,7 +116,7 @@ func registerKey(baseUrl *url.URL, keyFile string, userId string) {
|
|||
fmt.Printf("Registered key id: %s\n", keyId)
|
||||
}
|
||||
|
||||
func runServer(simulateCaddy bool, useTempDb bool, dbPath string) {
|
||||
func runServer(useTempDb bool, dbPath string) {
|
||||
var keyDir keydirectory.RegistrationDirectory
|
||||
|
||||
if useTempDb {
|
||||
|
@ -131,5 +130,5 @@ func runServer(simulateCaddy bool, useTempDb bool, dbPath string) {
|
|||
}
|
||||
}
|
||||
|
||||
server.Start(simulateCaddy, keyDir)
|
||||
server.Start(keyDir)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue