Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/k6/next/using-k6/secret-source/file.md, or by sending Accept: text/markdown to https://grafana.com/docs/k6/next/using-k6/secret-source/file/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
File secret source
The file secret source loads secrets from a plain text file.
Each line in the file contains one secret in key=value format:
secret=very secret
someotherkey=another secretTo use the file secret source, specify the file path with the --secret-source flag:
k6 run --secret-source=file=secrets.file script.jsdocker run -it --rm \
-v <SCRIPT_DIR>:/scripts \
grafana/k6 run --secret-source=file=/scripts/secrets.file /scripts/script.jsIn the Docker example, replace <SCRIPT_DIR> with the absolute path to the directory that contains your script and secrets file.
Was this page helpful?
Related resources from Grafana Labs

