Coder Social home page Coder Social logo

and3rson / convensul Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 17 KB

Initializes environment with env vars from Consul YAML document and runs app.

License: GNU General Public License v3.0

Shell 100.00%
consul envconsul convensul environment environment-variables hashicorp hashicorp-consul

convensul's Introduction

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:

# KV: /config/app
FOO: bar
SPAM: eggs

Let's create a simple Python app that uses env variables:

# application.py
import os

print('Foo is %s.' % os.environ['FOO'])
print('Spam is best served with %s.' % os.environ['SPAM'])

Now let's run convensul:

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

$ 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.

convensul's People

Contributors

and3rson avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.