mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-15 12:30:38 +08:00
Accept server flags to toggle TLS
This commit is contained in:
@@ -1,9 +1,37 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"errors"
|
||||||
|
"flag"
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
type Server struct {
|
||||||
fmt.Println("Let's build the server!")
|
tls *bool
|
||||||
|
key *string
|
||||||
|
cert *string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (server *Server) Start() error {
|
||||||
|
return errors.New("server start to be implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
tls := flag.Bool("tls", false, "Start the server in TLS mode.")
|
||||||
|
key := flag.String("key", "", "The private key file path.")
|
||||||
|
cert := flag.String("cert", "", "The signed certificate file path.")
|
||||||
|
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
server := &Server{
|
||||||
|
tls: tls,
|
||||||
|
key: key,
|
||||||
|
cert: cert,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := server.Start()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user