Skip to content

Commit

Permalink
ref
Browse files Browse the repository at this point in the history
  • Loading branch information
wujunzhuo committed Sep 21, 2023
1 parent faf372f commit 2c0eb7b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,21 @@ func GetRootPath() string {
}

func parseURL(url string, opts *serverless.Options) error {
url = strings.TrimSpace(url)
if url == "" {
url = "localhost:9000"
}

splits := strings.Split(strings.TrimSpace(url), ":")
l := len(splits)
if l != 2 {
splits := strings.Split(url, ":")
if len(splits) != 2 {
return fmt.Errorf(`the format of url "%s" is incorrect, it should be "host:port", e.g. localhost:9000`, url)
}

port, err := strconv.Atoi(splits[1])
if err != nil {
return fmt.Errorf("%s: invalid port: %s", url, splits[1])
}

opts.ZipperAddr = fmt.Sprintf("%s:%d", splits[0], port)

return nil
Expand Down

0 comments on commit 2c0eb7b

Please sign in to comment.