mirror of
https://github.com/yudai/gotty.git
synced 2026-02-28 10:54:08 +01:00
Fix TLS crt/key file loading
This commit is contained in:
parent
5622bf7538
commit
e7e607b3d7
1 changed files with 7 additions and 6 deletions
13
app/app.go
13
app/app.go
|
|
@ -64,8 +64,8 @@ var DefaultOptions = Options{
|
||||||
RandomUrlLength: 8,
|
RandomUrlLength: 8,
|
||||||
IndexFile: "",
|
IndexFile: "",
|
||||||
EnableTLS: false,
|
EnableTLS: false,
|
||||||
TLSCrtFile: "~/.gotty.key",
|
TLSCrtFile: "~/.gotty.crt",
|
||||||
TLSKeyFile: "~/.gotty.crt",
|
TLSKeyFile: "~/.gotty.key",
|
||||||
TitleFormat: "GoTTY - {{ .Command }} ({{ .Hostname }})",
|
TitleFormat: "GoTTY - {{ .Command }} ({{ .Hostname }})",
|
||||||
EnableReconnect: false,
|
EnableReconnect: false,
|
||||||
ReconnectTime: 10,
|
ReconnectTime: 10,
|
||||||
|
|
@ -233,10 +233,11 @@ func (app *App) Run() error {
|
||||||
&http.Server{Addr: endpoint, Handler: siteHandler},
|
&http.Server{Addr: endpoint, Handler: siteHandler},
|
||||||
)
|
)
|
||||||
if app.options.EnableTLS {
|
if app.options.EnableTLS {
|
||||||
err = app.server.ListenAndServeTLS(
|
crtFile := ExpandHomeDir(app.options.TLSCrtFile)
|
||||||
ExpandHomeDir(app.options.TLSCrtFile),
|
keyFile := ExpandHomeDir(app.options.TLSKeyFile)
|
||||||
ExpandHomeDir(app.options.TLSKeyFile),
|
log.Printf("TLS crt file: " + crtFile)
|
||||||
)
|
log.Printf("TLS key file: " + keyFile)
|
||||||
|
err = app.server.ListenAndServeTLS(crtFile, keyFile)
|
||||||
} else {
|
} else {
|
||||||
err = app.server.ListenAndServe()
|
err = app.server.ListenAndServe()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue