mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
feat: support override with environment variable WDA_PORT, WDA_MJPEG_PORT
This commit is contained in:
@@ -11,7 +11,9 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
giDevice "github.com/electricbubble/gidevice"
|
giDevice "github.com/electricbubble/gidevice"
|
||||||
@@ -46,6 +48,27 @@ func InitWDAClient(device *IOSDevice) (*DriverExt, error) {
|
|||||||
if device.UDID != "" {
|
if device.UDID != "" {
|
||||||
deviceOptions = append(deviceOptions, WithUDID(device.UDID))
|
deviceOptions = append(deviceOptions, WithUDID(device.UDID))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wda_port := os.Getenv("WDA_PORT")
|
||||||
|
if wda_port != "" {
|
||||||
|
if port, err := strconv.Atoi(wda_port); err == nil {
|
||||||
|
log.Info().Str("WDA_PORT", wda_port).
|
||||||
|
Msg("override with environment variable")
|
||||||
|
device.Port = port
|
||||||
|
} else {
|
||||||
|
log.Error().Err(err).Msg("invalid WDA_PORT, ignored")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wda_mjpeg_port := os.Getenv("WDA_MJPEG_PORT")
|
||||||
|
if wda_mjpeg_port != "" {
|
||||||
|
if mjpeg_port, err := strconv.Atoi(wda_mjpeg_port); err == nil {
|
||||||
|
log.Info().Str("WDA_MJPEG_PORT", wda_mjpeg_port).
|
||||||
|
Msg("override with environment variable")
|
||||||
|
device.MjpegPort = mjpeg_port
|
||||||
|
} else {
|
||||||
|
log.Error().Err(err).Msg("invalid WDA_MJPEG_PORT, ignored")
|
||||||
|
}
|
||||||
|
}
|
||||||
if device.Port != 0 {
|
if device.Port != 0 {
|
||||||
deviceOptions = append(deviceOptions, WithPort(device.Port))
|
deviceOptions = append(deviceOptions, WithPort(device.Port))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v4.3.0-beta-09291727
|
v4.3.0-beta-09292020
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__ = "v4.3.0-beta-09291727"
|
__version__ = "v4.3.0-beta-09292020"
|
||||||
__description__ = "One-stop solution for HTTP(S) testing."
|
__description__ = "One-stop solution for HTTP(S) testing."
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "httprunner"
|
name = "httprunner"
|
||||||
version = "v4.3.0-beta-09291727"
|
version = "v4.3.0-beta-09292020"
|
||||||
description = "One-stop solution for HTTP(S) testing."
|
description = "One-stop solution for HTTP(S) testing."
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
Reference in New Issue
Block a user