Unverified Commit a3fd415c authored by Péter Szilágyi's avatar Péter Szilágyi Committed by GitHub

Merge pull request #18235 from karalabe/puppeth-enforce-lowercase

cmd/puppeth: enforce lowercase network names
parents f850123e 4825d9c3
...@@ -49,8 +49,8 @@ func main() { ...@@ -49,8 +49,8 @@ func main() {
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
network := c.String("network") network := c.String("network")
if strings.Contains(network, " ") || strings.Contains(network, "-") { if strings.Contains(network, " ") || strings.Contains(network, "-") || strings.ToLower(network) != network {
log.Crit("No spaces or hyphens allowed in network name") log.Crit("No spaces, hyphens or capital letters allowed in network name")
} }
// Start the wizard and relinquish control // Start the wizard and relinquish control
makeWizard(c.String("network")).run() makeWizard(c.String("network")).run()
......
...@@ -61,14 +61,14 @@ func (w *wizard) run() { ...@@ -61,14 +61,14 @@ func (w *wizard) run() {
// Make sure we have a good network name to work with fmt.Println() // Make sure we have a good network name to work with fmt.Println()
// Docker accepts hyphens in image names, but doesn't like it for container names // Docker accepts hyphens in image names, but doesn't like it for container names
if w.network == "" { if w.network == "" {
fmt.Println("Please specify a network name to administer (no spaces or hyphens, please)") fmt.Println("Please specify a network name to administer (no spaces, hyphens or capital letters please)")
for { for {
w.network = w.readString() w.network = w.readString()
if !strings.Contains(w.network, " ") && !strings.Contains(w.network, "-") { if !strings.Contains(w.network, " ") && !strings.Contains(w.network, "-") && strings.ToLower(w.network) == w.network {
fmt.Printf("\nSweet, you can set this via --network=%s next time!\n\n", w.network) fmt.Printf("\nSweet, you can set this via --network=%s next time!\n\n", w.network)
break break
} }
log.Error("I also like to live dangerously, still no spaces or hyphens") log.Error("I also like to live dangerously, still no spaces, hyphens or capital letters")
} }
} }
log.Info("Administering Ethereum network", "name", w.network) log.Info("Administering Ethereum network", "name", w.network)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment