hashicorp / hashicorp/consul

Pass environment variable to check script

Open
#4,520 2 comments 4 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

#### Feature Description

Currently as far as I know, there is no way to pass shell environment variable to check script. I think if we can pass the necessary variables to check, user can maintain their check configuration cleaner.

#### Use Case(s)
I have to add bash command for my check script which use OpenStack environment (OS_AUTH_URL...) to avoid the limitation that I said.

If the requested feature added, I can change my configuration

AS-IS
```
"check": {
"name": "Check routing table",
"interval": "10s",
"args": [
"/bin/bash",
"-c",
"source /etc/consul/conf.d/openrc_v3; /opt/sanitychecker/bin/sanitychecker route"
]
}
```

TO-BE
```
"check": {
"name": "Check routing table",
"interval": "10s",
"args": [
"/opt/sanitychecker/bin/sanitychecker", "route"
]
"environments": [
OS_SERVICE_TOKEN=...
OS_SERVICE_ENDPOINT=...
OS_TENANT_NAME=...
OS_USERNAME=...
OS_PASSWORD=...
OS_AUTH_URL=...
]
}
```

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.