Skip to content

Commit

Permalink
[release/v1.2] Update local.file.md (#2111)
Browse files Browse the repository at this point in the history
* Update local.file.md

when trying to use `local.file` it seemed to be missing an example of how to use it.

* Update docs/sources/reference/components/local/local.file.md

Co-authored-by: Clayton Cornell <[email protected]>

* Update docs/sources/reference/components/local/local.file.md

Co-authored-by: Clayton Cornell <[email protected]>

* Fixed the workding of the example

---------

Co-authored-by: Clayton Cornell <[email protected]>
(cherry picked from commit 2eecbfe)

Co-authored-by: Bob Cotton <[email protected]>
  • Loading branch information
github-actions[bot] and bcotton authored Nov 15, 2024
1 parent 5fb877e commit b444364
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion docs/sources/reference/components/local/local.file.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ Name | Type | Description
----------|----------------------|---------------------------------------------------
`content` | `string` or `secret` | The contents of the file from the most recent read

The `content` field will have the `secret` type only if the `is_secret` argument was true.
The `content` field will have the `secret` type only if the `is_secret` argument was true.

You can use `local.file.LABEL.content` to access the contents of the file.

## Component health

Expand All @@ -66,9 +68,15 @@ The read error will be exposed as a log message and in the debug information for

## Example

The following example shows a simple `local.file` configuration that watches a passwords text file and uses the exported content field.

```alloy
local.file "secret_key" {
filename = "/var/secrets/password.txt"
is_secret = true
}
grafana_cloud.stack "receivers" {
stack_name = "mystack"
token = local.file.secret_key.content
}
```

0 comments on commit b444364

Please sign in to comment.