Book Image

Heroku Cookbook

By : Mike Coutermarsh
Book Image

Heroku Cookbook

By: Mike Coutermarsh

Overview of this book

Heroku is a Platform as a Service that enables developers to rapidly deploy and scale their web applications. Heroku is designed for developer happiness, freeing developers from doing system administrative tasks such as configuring servers and setting up load balancers. Developers are able to focus on what they do best, building web applications, while leaving the details of deployment and scaling to the experts at Heroku. This practical guide is packed with step-by-step solutions to problems faced by every production-level web application hosted on Heroku. You'll quickly get comfortable with managing your Heroku applications from the command line and then learn everything you need to know to deploy and administer production-level web applications.
Table of Contents (17 chapters)
Heroku Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing configuration variables


When enabling a Heroku add-on, such a Redis-to-go or MemCachier, the add-on automatically populates our configuration variables with the add-on credentials. They are able to do this because of the Heroku API. Configuration variables are a core part of any Heroku application. In this recipe, we'll learn how to manage them via the API.

Note

Be sure to read the Getting started with the Platform API gem recipe before attempting this recipe.

How to do it…

To begin, we can fire up a terminal and navigate to our heroku-api-examples directory. Then, we can perform the following steps:

  1. We'll be practicing in the console. Let's start it up now:

    $ ruby console.rb
    
  2. Let's take a look at the available commands for the config-vars endpoint by using Pry's ls -m command:

    $ ls -m heroku_api.config_var
    PlatformAPI::ConfigVar#methods: info  update
    
  3. We can use the info command to view all of the configuration variables for an application. This command will return the variables in a...