Adapted var names. old ones were missleading.

This commit is contained in:
Gianluca 2016-04-11 10:21:34 +02:00
parent 6114f8b6e7
commit ce773a2065
2 changed files with 15 additions and 15 deletions

View file

@ -69,21 +69,21 @@ func (c *Configuration) ServerPath() string {
// CertPath gets the path for certificates. // CertPath gets the path for certificates.
func (c *Configuration) CertPath() string { func (c *Configuration) CertPath() string {
pathS, err := c.context.PersistentFlags().GetString("path") pathStr, err := c.context.PersistentFlags().GetString("path")
if err != nil { if err != nil {
log.Fatalln(err.Error()) log.Fatalln(err.Error())
} }
return path.Join(pathS, "certificates") return path.Join(pathStr, "certificates")
} }
// AccountsPath returns the OS dependent path to the // AccountsPath returns the OS dependent path to the
// local accounts for a specific CA // local accounts for a specific CA
func (c *Configuration) AccountsPath() string { func (c *Configuration) AccountsPath() string {
pathS, err := c.context.PersistentFlags().GetString("path") pathStr, err := c.context.PersistentFlags().GetString("path")
if err != nil { if err != nil {
log.Fatalln(err.Error()) log.Fatalln(err.Error())
} }
return path.Join(pathS, "accounts", c.ServerPath()) return path.Join(pathStr, "accounts", c.ServerPath())
} }
// AccountPath returns the OS dependent path to a particular account // AccountPath returns the OS dependent path to a particular account

View file

@ -69,11 +69,11 @@ func SaveCertRes(certRes acme.CertificateResource, conf *Configuration) {
} }
func Setup(c *cobra.Command) (*Configuration, *Account, *acme.Client) { func Setup(c *cobra.Command) (*Configuration, *Account, *acme.Client) {
pathS, err := c.PersistentFlags().GetString("path") pathStr, err := c.PersistentFlags().GetString("path")
if err != nil { if err != nil {
logger().Fatalf(err.Error()) logger().Fatalf(err.Error())
} }
err = CheckFolder(pathS) err = CheckFolder(pathStr)
if err != nil { if err != nil {
logger().Fatalf("Could not check/create path: %s", err.Error()) logger().Fatalf("Could not check/create path: %s", err.Error())
} }
@ -106,21 +106,21 @@ func Setup(c *cobra.Command) (*Configuration, *Account, *acme.Client) {
logger().Fatalf("Could not create client: %s", err.Error()) logger().Fatalf("Could not create client: %s", err.Error())
} }
excludeS, err := c.PersistentFlags().GetStringSlice("exclude") excludeStr, err := c.PersistentFlags().GetStringSlice("exclude")
if err != nil { if err != nil {
logger().Fatal(err.Error()) logger().Fatal(err.Error())
} }
if len(excludeS) > 0 { if len(excludeStr) > 0 {
client.ExcludeChallenges(conf.ExcludedSolvers()) client.ExcludeChallenges(conf.ExcludedSolvers())
} }
webrootS, err := c.PersistentFlags().GetString("webroot") webrootStr, err := c.PersistentFlags().GetString("webroot")
if err != nil { if err != nil {
logger().Fatal(err.Error()) logger().Fatal(err.Error())
} }
if len(webrootS) > 0 { if len(webrootStr) > 0 {
provider, err := webroot.NewHTTPProvider(webrootS) provider, err := webroot.NewHTTPProvider(webrootStr)
if err != nil { if err != nil {
logger().Fatal(err) logger().Fatal(err)
} }
@ -132,15 +132,15 @@ func Setup(c *cobra.Command) (*Configuration, *Account, *acme.Client) {
client.ExcludeChallenges([]acme.Challenge{acme.DNS01, acme.TLSSNI01}) client.ExcludeChallenges([]acme.Challenge{acme.DNS01, acme.TLSSNI01})
} }
httpS, err := c.PersistentFlags().GetString("http") httpStr, err := c.PersistentFlags().GetString("http")
if err != nil { if err != nil {
logger().Fatal(err.Error()) logger().Fatal(err.Error())
} }
if len(httpS) > 0 { if len(httpStr) > 0 {
if strings.Index(httpS, ":") == -1 { if strings.Index(httpStr, ":") == -1 {
logger().Fatalf("The --http switch only accepts interface:port or :port for its argument.") logger().Fatalf("The --http switch only accepts interface:port or :port for its argument.")
} }
client.SetHTTPAddress(httpS) client.SetHTTPAddress(httpStr)
} }
tls, err := c.PersistentFlags().GetString("tls") tls, err := c.PersistentFlags().GetString("tls")