# Configuration
URL: /configuration
Explore how to manage test settings with OpenHTF's configuration module using in-code definitions or external configuration files.
Control test execution parameters with configuration variables or files.
Sometimes you need to change script parameters without modifying the script itself, like updating firmware versions or adjusting instrument ports between stations. OpenHTF simplifies this by using configuration files to manage these parameters.
You can load configurations from an external file written in YAML or JSON format. Passing `--config-file config.yaml` on the command line does the same without code (see CLI flags). For example:
Load the configuration file during execution script:
OpenHTF declares a few keys itself. Set them in the same file or with `--config-value key=value`:
Name of the test station written to every record. Default: the machine's hostname.
Port for the Operator UI. Default `0` picks a free port.
Same switch as `test.configure(stop_on_first_failure=True)` — see Test Options.
If `True`, a declared measurement that is never set does not fail the phase. Default `False`.
Store the source code of phases in the record's `code_info`. Default `False`.
Minimum seconds between Operator UI updates. Default `0.15`.
Multicast settings for the multi-station dashboard.
Run any test with `--config-help` to print every declared key with its description and default.
You can set configuration variables directly in the script.
You can set the following parameters for each configuration variable in OpenHTF:
The unique identifier for the configuration variable (must be in
snake\_case).
An optional value that serves as the default if no other value is provided.
An optional description explaining the purpose of the configuration
variable.
You can use the `save_and_restore` decorator to temporarily change a value during the function call, which is then restored.
In this example, you can also configure the variable after its declaration.