<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jeffrey Konowitch on Medium]]></title>
        <description><![CDATA[Stories by Jeffrey Konowitch on Medium]]></description>
        <link>https://medium.com/@jkonowitch?source=rss-29d6b227ea79------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*uR7-pVSvDaBJKBk6.jpg</url>
            <title>Stories by Jeffrey Konowitch on Medium</title>
            <link>https://medium.com/@jkonowitch?source=rss-29d6b227ea79------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 08:30:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jkonowitch/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Keeping API Keys Secret in Ruby on Rails]]></title>
            <link>https://medium.com/wdi-nyc-jan-2014/keeping-api-keys-secret-in-ruby-on-rails-6ddb0793d281?source=rss-29d6b227ea79------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ddb0793d281</guid>
            <dc:creator><![CDATA[Jeffrey Konowitch]]></dc:creator>
            <pubDate>Fri, 14 Feb 2014 16:24:57 GMT</pubDate>
            <atom:updated>2014-02-14T16:26:17.158Z</atom:updated>
            <content:encoded><![CDATA[<h4>Spoiler: Use Environment Variables!</h4><p>When writing web applications we often interact with 3rd party APIs using private authentication credentials. Instead of committing our private API keys to our codebase (insecure!) let’s learn how to make use of <strong>environment variables</strong> to keep our keys secret.</p><p>Environment variables are key/value pairs which are stored by your operating system, and can be accessed by any running program. To see a list of these, in your terminal type the `env` command.</p><p>You should see something like this:</p><pre>$ env</pre><pre>TERM_PROGRAM=Apple_Terminal</pre><pre>SHELL=/bin/bash</pre><pre>TERM=xterm-256color</pre><pre>HISTSIZE=32768</pre><pre>CLICOLOR=1</pre><p>Why is helpful. Well, we can add our private API keys as environment variables and then access them in our Rails application. That way, they never hit our code base!</p><ol><li>Add your API keys as environment variables. In your `~/.bash_profile`:</li></ol><pre>export INSTAGRAM_CLIENT_ID=”34SDKJ$ASDKJDS”</pre><p>2. In the terminal:</p><pre>source ~/.bash_profile</pre><p>3. In your Rails app — create a `config/initializers/api.rb` file and add:</p><pre>INSTAGRAM_CLIENT_ID = ENV[“INSTAGRAM_CLIENT_ID”]</pre><p>Initializers are run when your Rails app boots up. What this line does is it creates a global constant `INSTAGRAM_CLIENT_ID` and assigns it to the value of the environment variable from your operating system with they same name. Because this is a global variable, you can now use it anywhere in your Rails app!</p><h4>Epilogue</h4><p>If you are deploying your app to Heroku, take a look at these instructions on how to set environment variables on your production server: <a href="https://devcenter.heroku.com/articles/config-vars">https://devcenter.heroku.com/articles/config-vars</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ddb0793d281" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wdi-nyc-jan-2014/keeping-api-keys-secret-in-ruby-on-rails-6ddb0793d281">Keeping API Keys Secret in Ruby on Rails</a> was originally published in <a href="https://medium.com/wdi-nyc-jan-2014">WDI NYC Jan 2014</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>