forked from SeleniumHQ/docker-selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: apply rule to format shell script
Signed-off-by: Viet Nguyen Duc <[email protected]>
- Loading branch information
Showing
37 changed files
with
561 additions
and
591 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,79 @@ | ||
#!/bin/bash | ||
|
||
function short_version() { | ||
local __long_version=$1 | ||
local __version_split=( ${__long_version//./ } ) | ||
local __major=${__version_split[0]} | ||
local __minor=${__version_split[1]} | ||
echo "${__major}.${__minor:0:1}" | ||
local __long_version=$1 | ||
local __version_split=(${__long_version//./ }) | ||
local __major=${__version_split[0]} | ||
local __minor=${__version_split[1]} | ||
echo "${__major}.${__minor:0:1}" | ||
} | ||
|
||
if [[ -z "$CONFIG_FILE" ]]; then | ||
FILENAME="/opt/selenium/config.toml" | ||
FILENAME="/opt/selenium/config.toml" | ||
else | ||
FILENAME="$CONFIG_FILE" | ||
FILENAME="$CONFIG_FILE" | ||
fi | ||
|
||
echo "[events] | ||
publish = \"tcp://${SE_EVENT_BUS_HOST}:${SE_EVENT_BUS_PUBLISH_PORT}\" | ||
subscribe = \"tcp://${SE_EVENT_BUS_HOST}:${SE_EVENT_BUS_SUBSCRIBE_PORT}\" | ||
" > "$FILENAME" | ||
" >"$FILENAME" | ||
|
||
if [[ -z "${SE_NODE_HOST}" ]] && [[ -z "${SE_NODE_PORT}" ]]; then | ||
echo "Configuring server..." | ||
echo "Configuring server..." | ||
else | ||
echo "[server]" >> "$FILENAME" | ||
echo "[server]" >>"$FILENAME" | ||
fi | ||
|
||
if [[ -z "${SE_NODE_HOST}" ]]; then | ||
echo "Setting up SE_NODE_HOST..." | ||
echo "Setting up SE_NODE_HOST..." | ||
else | ||
echo "host = \"${SE_NODE_HOST}\"" >> "$FILENAME" | ||
echo "host = \"${SE_NODE_HOST}\"" >>"$FILENAME" | ||
fi | ||
|
||
if [[ -z "${SE_NODE_PORT}" ]]; then | ||
echo "Setting up SE_NODE_PORT..." | ||
echo "Setting up SE_NODE_PORT..." | ||
else | ||
echo "port = \"${SE_NODE_PORT}\"" >> "$FILENAME" | ||
echo "port = \"${SE_NODE_PORT}\"" >>"$FILENAME" | ||
fi | ||
|
||
echo "[node]" >> "$FILENAME" | ||
echo "[node]" >>"$FILENAME" | ||
# String, Url where the Grid can be reached | ||
if [[ -z "${SE_NODE_GRID_URL}" ]]; then | ||
echo "Setting up SE_NODE_GRID_URL..." | ||
echo "Setting up SE_NODE_GRID_URL..." | ||
else | ||
echo "grid-url = \"${SE_NODE_GRID_URL}\"" >> "$FILENAME" | ||
echo "grid-url = \"${SE_NODE_GRID_URL}\"" >>"$FILENAME" | ||
fi | ||
echo "session-timeout = \"${SE_NODE_SESSION_TIMEOUT}\"" >> "$FILENAME" | ||
echo "override-max-sessions = ${SE_NODE_OVERRIDE_MAX_SESSIONS}" >> "$FILENAME" | ||
echo "detect-drivers = false" >> "$FILENAME" | ||
echo "drain-after-session-count = ${DRAIN_AFTER_SESSION_COUNT:-$SE_DRAIN_AFTER_SESSION_COUNT}" >> "$FILENAME" | ||
echo "session-timeout = \"${SE_NODE_SESSION_TIMEOUT}\"" >>"$FILENAME" | ||
echo "override-max-sessions = ${SE_NODE_OVERRIDE_MAX_SESSIONS}" >>"$FILENAME" | ||
echo "detect-drivers = false" >>"$FILENAME" | ||
echo "drain-after-session-count = ${DRAIN_AFTER_SESSION_COUNT:-$SE_DRAIN_AFTER_SESSION_COUNT}" >>"$FILENAME" | ||
# When node is handled both browser and relay, SE_NODE_MAX_CONCURRENCY is used to configure max concurrency based on sum of them | ||
echo "max-sessions = ${SE_NODE_MAX_CONCURRENCY:-${SE_NODE_MAX_SESSIONS}} | ||
" >> "$FILENAME" | ||
" >>"$FILENAME" | ||
|
||
if [ -f /opt/selenium/browser_name ]; then | ||
SE_NODE_BROWSER_NAME=$(cat /opt/selenium/browser_name) | ||
SE_NODE_BROWSER_NAME=$(cat /opt/selenium/browser_name) | ||
fi | ||
if [ -f /opt/selenium/browser_version ]; then | ||
SE_NODE_BROWSER_VERSION=$(short_version $(cat /opt/selenium/browser_version)) | ||
SE_NODE_BROWSER_VERSION=$(short_version $(cat /opt/selenium/browser_version)) | ||
fi | ||
if [ -f /opt/selenium/browser_binary_location ]; then | ||
SE__BROWSER_BINARY_LOCATION=$(cat /opt/selenium/browser_binary_location) | ||
SE__BROWSER_BINARY_LOCATION=$(cat /opt/selenium/browser_binary_location) | ||
fi | ||
|
||
# 'browserName' is mandatory for default stereotype | ||
if [[ -z "${SE_NODE_STEREOTYPE}" ]] && [[ -n "${SE_NODE_BROWSER_NAME}" ]]; then | ||
SE_NODE_STEREOTYPE="{\"browserName\": \"${SE_NODE_BROWSER_NAME}\", \"browserVersion\": \"${SE_NODE_BROWSER_VERSION}\", \"platformName\": \"Linux\", ${SE__BROWSER_BINARY_LOCATION}, \"se:containerName\": \"${SE_NODE_CONTAINER_NAME}\"}" | ||
SE_NODE_STEREOTYPE="{\"browserName\": \"${SE_NODE_BROWSER_NAME}\", \"browserVersion\": \"${SE_NODE_BROWSER_VERSION}\", \"platformName\": \"Linux\", ${SE__BROWSER_BINARY_LOCATION}, \"se:containerName\": \"${SE_NODE_CONTAINER_NAME}\"}" | ||
else | ||
SE_NODE_STEREOTYPE="${SE_NODE_STEREOTYPE}" | ||
SE_NODE_STEREOTYPE="${SE_NODE_STEREOTYPE}" | ||
fi | ||
|
||
# 'stereotype' setting is mandatory | ||
if [[ -n "${SE_NODE_STEREOTYPE}" ]]; then | ||
echo "[[node.driver-configuration]]" >> "$FILENAME" | ||
echo "display-name = \"${SE_NODE_BROWSER_NAME}\"" >> "$FILENAME" | ||
echo "stereotype = '${SE_NODE_STEREOTYPE}'" >> "$FILENAME" | ||
echo "max-sessions = ${SE_NODE_MAX_SESSIONS} | ||
" >> "$FILENAME" | ||
echo "[[node.driver-configuration]]" >>"$FILENAME" | ||
echo "display-name = \"${SE_NODE_BROWSER_NAME}\"" >>"$FILENAME" | ||
echo "stereotype = '${SE_NODE_STEREOTYPE}'" >>"$FILENAME" | ||
echo "max-sessions = ${SE_NODE_MAX_SESSIONS} | ||
" >>"$FILENAME" | ||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
#!/bin/bash | ||
|
||
if [[ -z "$CONFIG_FILE" ]]; then | ||
FILENAME="/opt/selenium/config.toml" | ||
FILENAME="/opt/selenium/config.toml" | ||
else | ||
FILENAME="$CONFIG_FILE" | ||
FILENAME="$CONFIG_FILE" | ||
fi | ||
|
||
if [[ -n "${SE_NODE_RELAY_URL}" ]]; then | ||
echo "[relay]" >> "$FILENAME" | ||
echo "url = \"${SE_NODE_RELAY_URL}\"" >> "$FILENAME" | ||
if [[ -z "${SE_NODE_RELAY_STATUS_ENDPOINT}" ]]; then | ||
echo "status-endpoint = \"/status\"" >> "$FILENAME" | ||
else | ||
echo "status-endpoint = \"${SE_NODE_RELAY_STATUS_ENDPOINT}\"" >> "$FILENAME" | ||
fi | ||
if [[ -n "${SE_NODE_RELAY_PROTOCOL_VERSION}" ]]; then | ||
echo "protocol-version = \"${SE_NODE_RELAY_PROTOCOL_VERSION}\"" >> "$FILENAME" | ||
fi | ||
echo "configs = [ | ||
echo "[relay]" >>"$FILENAME" | ||
echo "url = \"${SE_NODE_RELAY_URL}\"" >>"$FILENAME" | ||
if [[ -z "${SE_NODE_RELAY_STATUS_ENDPOINT}" ]]; then | ||
echo "status-endpoint = \"/status\"" >>"$FILENAME" | ||
else | ||
echo "status-endpoint = \"${SE_NODE_RELAY_STATUS_ENDPOINT}\"" >>"$FILENAME" | ||
fi | ||
if [[ -n "${SE_NODE_RELAY_PROTOCOL_VERSION}" ]]; then | ||
echo "protocol-version = \"${SE_NODE_RELAY_PROTOCOL_VERSION}\"" >>"$FILENAME" | ||
fi | ||
echo "configs = [ | ||
\"${SE_NODE_RELAY_MAX_SESSIONS}\", \"{\\\"browserName\\\": \\\"${SE_NODE_RELAY_BROWSER_NAME}\\\", \\\"platformName\\\": \\\"${SE_NODE_RELAY_PLATFORM_NAME}\\\", \\\"appium:platformVersion\\\": \\\"${SE_NODE_RELAY_PLATFORM_VERSION}\\\"}\" | ||
] | ||
" >> "$FILENAME" | ||
" >>"$FILENAME" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.