-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for server options (-s
and -o
)
#19
Merged
robinmanuelthiel
merged 1 commit into
robinmanuelthiel:master
from
bazzani:add-support-for-server-flags
Jun 17, 2024
Merged
Add support for server options (-s
and -o
)
#19
robinmanuelthiel
merged 1 commit into
robinmanuelthiel:master
from
bazzani:add-support-for-server-flags
Jun 17, 2024
Conversation
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
Hi @robinmanuelthiel, I have tested the container with the following scenarios and they all behave as I expected. Please do let me know if you would like any changes made, or indeed if we should carry out some more testing.
|
a78c2ff
to
bb13164
Compare
We want to be able to pass a server ID or fully qualified hostname to the speedtest CLI command so that we can use a specific server to test against, rather than the default server that the CLI selects for us. This change adds two new mutually exclusive environment variables which can be used to specify either: 1. `SPEEDTEST_SERVER_ID` - A server from the server list using its id 2. `SPEEDTEST_HOSTNAME` - A server, from the server list, using its host's fully qualified domain name Impact on the speedtest CLI command: 1. If `SPEEDTEST_SERVER_ID` is specified, the `-s` option will be added 2. If `SPEEDTEST_HOSTNAME` is specified, the `-o` option will be added 3. If both environment variables are specified, the container will error out and not run the speedtest CLI command 4. If neither of the new environment variables are not present, the CLI command will be called as usual with the default server - `JSON=$(speedtest --accept-license --accept-gdpr -f json)` 5. If you specify an invalid server ID/host name you will see an error: - `{"type":"log","timestamp":"2024-06-17T03:39:08Z","message":"Configuration - No servers defined (NoServersException)","level":"error"}` --- To get the available ids, sponsors, and hostnames from speedtest run: - `curl -s https://cli.speedtest.net/api/cli/config | jq -r '.servers[] | "id: \(.id), sponsor: \(.sponsor), host: \(.host)"'` and you will get a response like: ``` id: 32298, sponsor: SYNLINQ, host: speedtest1.synlinq.de:8080 id: 44081, sponsor: 23M GmbH, host: speedtest.23m.com:8080 id: 53257, sponsor: LWLcom GmbH, host: netservice01.fra02.lwlcom.net:8080 id: 40094, sponsor: PVDataNet, host: speedtestde.pvdatanet.com:8080 id: 55462, sponsor: Twerion.net | Minecraft Server, host: speedtest.twerion.net:8080 id: 37492, sponsor: Melbicom, host: speedtest-fra.melbicom.net:8080 id: 10010, sponsor: fdcservers.net, host: lg-fra.fdcservers.net:8080 id: 54504, sponsor: Deutsche Glasfaser, host: speed2.dg-sys.net:8080 id: 46569, sponsor: wirsNET, host: speed1.wirsnet.com:8080 id: 23712, sponsor: kko.me | avrx.de, host: speedtest.kko.me:8080 ``` Remove the port number from the entry and run the container with the new environment variable, for example: - `docker run -e SPEEDTEST_SERVER_ID=32298 robinmanuelthiel/speedtest:latest` - `docker run -e SPEEDTEST_HOSTNAME=speedtest1.synlinq.de robinmanuelthiel/speedtest:latest`
bb13164
to
cf30d79
Compare
bazzani
commented
Jun 17, 2024
Looks lovely, thanks a lot! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want to be able to pass a server ID or fully qualified hostname to the speedtest CLI command so that we can use a specific server to test against, rather than the default server that the CLI selects for us.
This change adds two new mutually exclusive environment variables which can be used to specify either:
SPEEDTEST_SERVER_ID
- A server from the server list using its idSPEEDTEST_HOSTNAME
- A server, from the server list, using its host's fully qualified domain nameImpact on the speedtest CLI command:
If
SPEEDTEST_SERVER_ID
is specified, the-s
option will be addedIf
SPEEDTEST_HOSTNAME
is specified, the-o
option will be addedIf both environment variables are specified, the container will error out and not run the speedtest CLI command
If neither of the new environment variables are not present, the CLI command will be called as usual with the default server
JSON=$(speedtest --accept-license --accept-gdpr -f json)
If you specify an invalid server ID/host name you will see an error:
{"type":"log","timestamp":"2024-06-17T03:39:08Z","message":"Configuration - No servers defined (NoServersException)","level":"error"}
To get the available ids, sponsors, and hostnames from speedtest run:
curl -s https://cli.speedtest.net/api/cli/config | jq -r '.servers[] | "id: \(.id), sponsor: \(.sponsor), host: \(.host)"'
and you will get a response like:
Remove the port number from the entry and run the container with the new environment variable, for example:
docker run -e SPEEDTEST_SERVER_ID=32298 robinmanuelthiel/speedtest:latest
docker run -e SPEEDTEST_HOSTNAME=speedtest1.synlinq.de robinmanuelthiel/speedtest:latest