1
0
mirror of https://github.com/rancher/os.git synced 2025-07-11 21:58:00 +00:00

Merge pull request #269 from wlan0/bugfix5

remove default directory from tls generate cmd
This commit is contained in:
Darren Shepherd 2015-04-30 22:14:00 -07:00
commit 3b374cb2c9

View File

@ -1,6 +1,7 @@
package control package control
import ( import (
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
@ -36,7 +37,7 @@ func tlsConfCommands() []cli.Command {
cli.StringFlag{ cli.StringFlag{
Name: "dir, d", Name: "dir, d",
Usage: "the directory to save/read the certs to/from", Usage: "the directory to save/read the certs to/from",
Value: "${HOME}/.docker", Value: "",
}, },
}, },
}, },
@ -132,7 +133,10 @@ func generate(c *cli.Context) error {
} }
generateServer := c.Bool("server") generateServer := c.Bool("server")
outDir := os.ExpandEnv(c.String("dir")) outDir := c.String("dir")
if outDir == "" {
return fmt.Errorf("out directory (-d, --dir) not specified")
}
caCertPath := filepath.Join(outDir, "ca.pem") caCertPath := filepath.Join(outDir, "ca.pem")
caKeyPath := filepath.Join(outDir, "ca-key.pem") caKeyPath := filepath.Join(outDir, "ca-key.pem")
certPath := filepath.Join(outDir, "cert.pem") certPath := filepath.Join(outDir, "cert.pem")