Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/and3rson/convensul
Initializes environment with env vars from Consul YAML document and runs app.
https://github.com/and3rson/convensul
consul convensul envconsul environment environment-variables hashicorp hashicorp-consul
Last synced: 3 days ago
JSON representation
Initializes environment with env vars from Consul YAML document and runs app.
- Host: GitHub
- URL: https://github.com/and3rson/convensul
- Owner: and3rson
- License: gpl-3.0
- Created: 2017-04-25T13:16:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-26T09:01:49.000Z (over 7 years ago)
- Last Synced: 2025-01-19T04:10:10.941Z (3 days ago)
- Topics: consul, convensul, envconsul, environment, environment-variables, hashicorp, hashicorp-consul
- Language: Shell
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Convensul
A lightweight bash version of the "envconsul" utility.
# Dependencies
- Core utils (`curl`, `awk` and `cut`)
# Usage
Imagine you have this kind of document in Consul KV storage:
```yaml
# KV: /config/app
FOO: bar
SPAM: eggs
```Let's create a simple Python app that uses env variables:
```python
# application.py
import osprint('Foo is %s.' % os.environ['FOO'])
print('Spam is best served with %s.' % os.environ['SPAM'])
```Now let's run `convensul`:
```bash
$ convensul.sh 127.0.0.1:8500 secret-acl-token /config/app python application.py
Foo is bar.
Spam is best server with eggs.
```You can also store the ACL token in the environment if you don't want to expose its value,
for example, if your script is used in some sort of CI, e. g. Jenkins.For this you need to set CONVENSUL_TOKEN env var to your token value and pass `-` instead of the token:
```bash
$ export CONVENSUL_TOKEN=secret-acl-token
$ convensul.sh 127.0.0.1:8500 - /config/app python application.py
Foo is bar.
Spam is best server with eggs.
```# Why "convensul"?
Because "convensul" is a mix of "consul" and "env": "conVENsul".
Also it has some sort of "convention" word meaning.