Skip to content

Commit

Permalink
Don't ignore --p12 in server:start
Browse files Browse the repository at this point in the history
When --p12 is given to server:start, use the specified file instead of
generating a certificate.
  • Loading branch information
pschultz committed Feb 9, 2022
1 parent 3074bcd commit 644d0e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions commands/local_server_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var localServerStartCmd = &console.Command{
&console.IntFlag{Name: "port", DefaultValue: 8000, Usage: "Preferred HTTP port"},
&console.BoolFlag{Name: "daemon", Aliases: []string{"d"}, Usage: "Run the server in the background"},
&console.BoolFlag{Name: "no-humanize", Usage: "Do not format JSON logs"},
&console.StringFlag{Name: "p12", Usage: "Certificate path (p12 format)"},
&console.StringFlag{Name: "p12", Usage: "Name of the file containing the TLS certificate to use in p12 format"},
&console.BoolFlag{Name: "no-tls", Usage: "Use HTTP instead of HTTPS"},
},
Action: func(c *console.Context) error {
Expand Down Expand Up @@ -137,12 +137,12 @@ var localServerStartCmd = &console.Command{
}

reexec.NotifyForeground("tls")
if !config.NoTLS {
if !config.NoTLS && config.PKCS12 == "" {
ca, err := cert.NewCA(filepath.Join(homeDir, "certs"))
if err != nil {
return errors.WithStack(err)
} else if !ca.HasCA() {
ui.Warning(fmt.Sprintf(`run "%s server:ca:install" first if you want to run the web server with TLS support, or use "--no-tls" to avoid this warning`, c.App.HelpName))
ui.Warning(fmt.Sprintf(`run "%s server:ca:install" first if you want to run the web server with TLS support, or use "--p12" or "--no-tls" to avoid this warning`, c.App.HelpName))
config.NoTLS = true
} else {
p12 := filepath.Join(homeDir, "certs", "default.p12")
Expand Down

0 comments on commit 644d0e6

Please sign in to comment.