mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-09 17:32:51 +00:00
adding tls
This commit is contained in:
@@ -24,5 +24,11 @@ func main(){
|
||||
handle := gziphandler.GzipHandler(route.Routes())
|
||||
|
||||
log.Println("Starting Server...")
|
||||
log.Println(http.ListenAndServe(":"+strconv.Itoa(configurations.Port), handle))
|
||||
go func(){
|
||||
log.Println(http.ListenAndServe(":"+strconv.Itoa(configurations.Port), handle))
|
||||
}()
|
||||
|
||||
if configurations.TLSCertFile != "" && configurations.TLSKeyFile != "" {
|
||||
log.Println(http.ListenAndServeTLS(":"+strconv.Itoa(configurations.TLSPort), configurations.TLSCertFile, configurations.TLSKeyFile, handle))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,12 @@ import (
|
||||
|
||||
//structure for application configurations
|
||||
type Config struct {
|
||||
Database db.DatabaseInfo `json:"database"`
|
||||
Api api.ApiInfo `json:"api"`
|
||||
Port int `json:"port"`
|
||||
Database db.DatabaseInfo `json:"Database"`
|
||||
Api api.ApiInfo `json:"Api"`
|
||||
Port int `json:"Port"`
|
||||
TLSPort int `json:"TLSPort"`
|
||||
TLSCertFile string `json:"TLSCertFile"`
|
||||
TLSKeyFile string `json:"TLSKeyFile"`
|
||||
}
|
||||
|
||||
//read the config file and return JsonObject struct
|
||||
|
||||
Reference in New Issue
Block a user