Skip to content
Configuration

Configuration

Every flag except --help can also be set with an environment variable, and every flag except --help and --config in a settings file.

Precedence

Each setting comes from the first of these that sets it:

  1. A flag on the command line
  2. Its SPEEDTEST_GO_ environment variable
  3. The settings file
  4. The flag’s default

Settings file

The settings file is YAML. Its default location depends on the platform:

PlatformPath
Linux$XDG_CONFIG_HOME/speedtest-go/config.yaml, which is ~/.config/speedtest-go/config.yaml by default
macOS~/Library/Application Support/speedtest-go/config.yaml
Windows%LOCALAPPDATA%\speedtest-go\config.yaml

--config or SPEEDTEST_GO_CONFIG names another file.

FileWhen it is missing
The default fileThe defaults apply
A file named by --config or SPEEDTEST_GO_CONFIGAn error

Its keys are the flag names in camelCase, such as pingMode for --ping-mode:

pingMode: tcp
unit: binary-bits
server: [6691, 6087]
filterCC: [gb, ie]
maskISP: true

The file is read strictly, so a typo never passes silently. These are errors:

  • An unknown key
  • A repeated key
  • A value of the wrong type
  • More than one YAML document

Environment variables

A setting’s environment variable is SPEEDTEST_GO_ followed by the flag name in upper case, with hyphens as underscores.

ValueFormat
Booleantrue or false
ListEntries separated by commas
SPEEDTEST_GO_PING_MODE=tcp SPEEDTEST_GO_DNS_BIND_SOURCE=true speedtest-go
SPEEDTEST_GO_SERVER=6691,6087 speedtest-go

Settings

Settings that apply to the speed test are ignored by list, cities, and version.

FlagEnvironment variableSettings file keyApplies to
--base-urlSPEEDTEST_GO_BASE_URLbaseURLEvery command
--citySPEEDTEST_GO_CITYcityEvery command
--custom-urlSPEEDTEST_GO_CUSTOM_URLcustomURLSpeed test
--debugSPEEDTEST_GO_DEBUGdebugEvery command
--dl-sizeSPEEDTEST_GO_DL_SIZEdlSizeSpeed test
--dns-bind-sourceSPEEDTEST_GO_DNS_BIND_SOURCEdnsBindSourceEvery command
--dscpSPEEDTEST_GO_DSCPdscpEvery command
--filter-ccSPEEDTEST_GO_FILTER_CCfilterCCEvery command
--jsonSPEEDTEST_GO_JSONjsonSpeed test
--jsonlSPEEDTEST_GO_JSONLjsonlSpeed test
--locationSPEEDTEST_GO_LOCATIONlocationEvery command
--mask-ispSPEEDTEST_GO_MASK_ISPmaskISPEvery command
--multiSPEEDTEST_GO_MULTImultiSpeed test
--no-downloadSPEEDTEST_GO_NO_DOWNLOADnoDownloadSpeed test
--no-uploadSPEEDTEST_GO_NO_UPLOADnoUploadSpeed test
--ping-modeSPEEDTEST_GO_PING_MODEpingModeSpeed test
--protocolSPEEDTEST_GO_PROTOCOLprotocolSpeed test
--proxySPEEDTEST_GO_PROXYproxyEvery command
--saving-modeSPEEDTEST_GO_SAVING_MODEsavingModeSpeed test
--searchSPEEDTEST_GO_SEARCHsearchEvery command
--serverSPEEDTEST_GO_SERVERserverSpeed test
--sourceSPEEDTEST_GO_SOURCEsourceEvery command
--threadSPEEDTEST_GO_THREADthreadSpeed test
--uaSPEEDTEST_GO_UAuaEvery command
--ul-sizeSPEEDTEST_GO_UL_SIZEulSizeSpeed test
--unitSPEEDTEST_GO_UNITunitSpeed test
--unixSPEEDTEST_GO_UNIXunixSpeed test

--config and its variable SPEEDTEST_GO_CONFIG name the settings file, so the file itself has no key for them.

Invalid settings

An invalid setting stops the command before it runs, and it exits with code 2. The error names where the value came from:

SourceNamed as
Flag--thread
Environment variableSPEEDTEST_GO_THREAD
Settings fileThe file’s path and the key, such as config.yaml: thread

Every invalid setting is reported at once, not just the first.