(input string)
| 1762 | } |
| 1763 | |
| 1764 | func parseTimeString(input string) (int, string, error) { |
| 1765 | input = strings.TrimSpace(input) |
| 1766 | |
| 1767 | matches := re.GetRegex(re.DurationWithOptionalUnitPattern).FindStringSubmatch(input) |
| 1768 | |
| 1769 | if len(matches) < 2 { |
| 1770 | return 0, "", fmt.Errorf("invalid time format: %s", input) |
| 1771 | } |
| 1772 | |
| 1773 | value, err := strconv.Atoi(matches[1]) |
| 1774 | if err != nil { |
| 1775 | return 0, "", fmt.Errorf("invalid number: %s", matches[1]) |
| 1776 | } |
| 1777 | |
| 1778 | unit := matches[2] |
| 1779 | if unit == "" { |
| 1780 | unit = "s" |
| 1781 | } |
| 1782 | return value, unit, nil |
| 1783 | } |
| 1784 | |
| 1785 | func parseUpstreamServers(reqServers []dto.NginxUpstreamServer) []*components.UpstreamServer { |
| 1786 | var servers []*components.UpstreamServer |
no outgoing calls
no test coverage detected