Integration Quickstart

Once you've Created An Organization or Accepted An Invitation, the next step is integrating EnvKey with your application so that you, your team, and your servers can access your config.

There are three steps:
1. Generate a development or server ENVKEY.
2. Copy your ENVKEY into a .env file or a server environment variable
3. Integrate with envkey-source or an EnvKey library.

a. envkey-source
b. envkey-ruby
c. envkey-python
d. envkey-node
e. envkeygo

1. Generate a development or server ENVKEY.

Open up the EnvKey App, sign in, select the application you want to integrate with in the sidebar, and then select the EnvKeys tab. You'll see Development Keys and depending on your access level, you might also see Server Keys. If you haven't generated any EnvKeys yet, you'll see a placeholder that looks like this:

When you click the GENERATE button for your development ENVKEY, you'll see something like this after a slight delay:

or if you generate a server ENVKEY, you'll see something like this:

2. Copy your ENVKEY into a .env file or a server environment variable.

Click the COPY button next to your generated ENVKEY to copy it to the system clipboard. If you're copying a development ENVKEY, create a .env file in the root of your project that looks like this:

# .env file

Also make sure your .env file is added to .gitignore if you're using git, or is appropriately ignored from source control if you're using another source control system.

# .gitignore file

If you're copying a server ENVKEY, set the ENVKEY environment variable on your server. How you do this will depend on your host and how you manage servers.

3. Integrate with envkey-source or an EnvKey library.

The quickest way to integrate EnvKey depends on the language you use. envkey-source is a bash utility that can be used to easily integrate EnvKey with any language through the shell or Docker. If you use Ruby, Python, Node.js, or Go, integrating with an official EnvKey library is even quicker.

3a. envkey-source

To integrate with envkey-source you first need to install it on your system. Open up a shell and run:

$ curl -s | bash

Then run:

$ eval $(envkey-source)

Now your bash shell will have all your EnvKey config set as environment variables, and any process you start from it (in any language) can access them.

If you're integrating with a server, you'll need to install envkey-source in your server's setup script or Dockerfile, and then run eval $(envkey-source) when starting or restarting your application server. Note that If you put eval $(envkey-source) inside a script file, you'll have to run that file with source if you want your config to subsequently be available outside the script.

Learn more about envkey-source on Github.
More details and examples on Docker integration.

Security Note: envkey-source wraps all EnvKey variables in single quotes (and escapes single quotes within the variable) to prevent shell injection.

3b. envkey-ruby

To integrate with Ruby or Ruby On Rails, first add the envkey gem to your Gemfile.

gem 'envkey'

Then run:

$ bundle install

If you're using Rails, that's all you need to do. If you're using Ruby without Rails, you need one more line at the entry point of your application:

require 'envkey'

Learn more about envkey-ruby on Github.

3c. envkey-python

To integrate with Python, first install the envkey package with pip.

$ pip install envkey

Then import it at the entry point of your application:

import envkey

Learn more about envkey-python on Github.

3d. envkey-node

To integrate with node.js, first install the envkey npm package.

$ npm install envkey --save

Then import it at the entry point of your application:

import 'envkey'

Or if you prefer ES5 syntax:


Learn more about envkey-node on Github.

Note: If also want to inject some of your EnvKey config into your client-side javascript, this can also be done (carefully) using the envkey-webpack-plugin.

3e. envkeygo

To integrate with Go, first install the envkeygo package:

$ go get

Then import it in your main.go file:

import _ ""

Learn more about envkeygo on Github.

Next: Sub-Environments And Overrides

results matching ""

    No results matching ""