34 lines
834 B
Go
Raw Normal View History

2018-07-08 08:02:53 +00:00
package main
import (
"crypto/tls"
"fmt"
"os"
"os/exec"
"github.com/blitzprog/color"
2018-07-08 08:02:53 +00:00
)
// testConnectivity will test if port 443 is accessible or not.
2018-12-04 23:47:28 +00:00
// If not, it will attempt to run "sudo make ports" and resume
2018-07-08 08:02:53 +00:00
// execution once the user has entered the password.
func testConnectivity() {
config := tls.Config{
InsecureSkipVerify: true,
}
_, err := tls.Dial("tcp", ":443", &config)
if err != nil {
fmt.Println("--------------------------------------------------------------------------------")
color.Red("HTTPS port 443 is not accessible")
fmt.Println("Running", color.YellowString("make ports"), "to be able to access", color.GreenString("https://"+app.Config.Domain))
cmd := exec.Command("sudo", "make", "ports")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
cmd.Run()
}
}