We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to know how I could use Mux for TSL configuration and handle https requests. Should I just implement the following to achieve it:
r := mux.NewRouter() r.HandleFunc("/", HomeHandler)
server := &http.Server{ Addr: ":" + *port, ReadTimeout: 5 * time.Minute, WriteTimeout: 10 * time.Second, TLSConfig: &tls.Config{ServerName: *host}, Handler: r,
}
if err := server.ListenAndServeTLS(*srvCert, *srvKey); err != nil { log.Fatal(err) }
Where the paths to *host, *port, *sevCert and *srvKey will be provided via command line call
Not sure this would work.
The text was updated successfully, but these errors were encountered:
Syntax is correct and it should work. For taking input from CLI, you need to write additional code using either os.Args, flag or a package like cobra.
os.Args
flag
cobra
Sorry, something went wrong.
@Leon16 can we close this issue? if there are no further questions or doubts?
No branches or pull requests
I would like to know how I could use Mux for TSL configuration and handle https requests. Should I just implement the following to achieve it:
server := &http.Server{
Addr: ":" + *port,
ReadTimeout: 5 * time.Minute,
WriteTimeout: 10 * time.Second,
TLSConfig: &tls.Config{ServerName: *host},
Handler: r,
}
if err := server.ListenAndServeTLS(*srvCert, *srvKey); err != nil {
log.Fatal(err)
}
Where the paths to *host, *port, *sevCert and *srvKey will be provided via command line call
Not sure this would work.
The text was updated successfully, but these errors were encountered: