Getting Started in 4 Minutes
Last updated
Last updated
This guide will help you take Jumpjet for a test flight in 4 minutes (guaranteed!).
You will use Jumpjet to inject 2 variables into a sign-up microservice in node.js. We'll walk you through the required steps:
That's it!
We do realize your world is way more complex than Hello World. We've designed Jumpjet so you can start using it now on a small group of new variables and migrate the rest later (see FAQ: can I use Jumpjet for very few config variables and migrate the others later?)
There are 2 variables in our sign-up microservice that should vary between our Dev and Prod environments:
URL of the app's MongoDB database (string)
Whether to require email verification for new sign-ups (boolean)
Log into Jumpjet, go to the Variables page and list those two variables. Leave the Default Value field empty. We will set their values at the environment level.
Go to the Environments page and add your two environments: Dev and Prod.
Click on an environment name (ex: Dev) to manage all the variable values within it. It makes sense to point Dev to a local MongoDB instance and disable email verification so developers can work with less friction:
Variable values will be different under Prod, of course. There we may set DB_URL to mongodb0.myapp.com:27017 and REQUIRE_EMAIL_VERIFICATION to true.
In the next section, we'll be doing things the node.js way and reading our variables from a .ENV file.
Let's use the Jumpjet CLI tool to create this .ENV file and inject the right value into it, based on the current environment. Create a template for an ENV file that contains Jumpjet placeholders - double curly brackets around the variables you manage in the Jumpjet UI. Here's one:
It's magic time. Get the Jumpjet CLI tool and run the following command, instructing Jumpjet to pull your Dev configuration from the cloud and create a .ENV file with the right values:
We specified Dev as the environment name, so the result .ENV file will look like this:
Node.js developers like to use dotenv to load .ENV file into the process's environment variables and access them. We'll do exactly that and log the variables at startup.
You can use the above process and put placeholders in any file (JSON, YAML), not just ENV.
Need help using Jumpjet? Drop us a line at hello@jumpjet.co.