---
title: "File secret source | Grafana k6 documentation"
description: "The file secret source loads secrets from a plain text file with key=value pairs"
---

# 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:

text ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```text
secret=very secret
someotherkey=another secret
```

To use the file secret source, specify the file path with the `--secret-source` flag:

Bash docker

![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
k6 run --secret-source=file=secrets.file script.js
```

docker ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```docker
docker run -it --rm \
  -v <SCRIPT_DIR>:/scripts \
  grafana/k6 run --secret-source=file=/scripts/secrets.file /scripts/script.js
```

In the Docker example, replace `<SCRIPT_DIR>` with the absolute path to the directory that contains your script and secrets file.
