Sharing API key from Multiple Heroku Apps

This article describes how to share a single Treasure Data API key between multiple Heroku applications.

Table of Contents

Prerequisites

  • The heroku-toolbelt.
  • The td-toolbelt.
  • The Heroku CLI plugin (to bridge the toolbelts above).

    :::terminal $ heroku plugins:install https://github.com/treasure-data/heroku-td.git $ heroku td usage: heroku td [options] COMMAND [args]

First App

Just provision your addon as shown below:

$ cd app1_dir
$ heroku addons:add treasure-data:nano
Adding treasure-data:nano on <your_app_name>... done, v3 (free)

You can get your apikey using the command below.

$ heroku td apikey:show
9832dsaf809123808fd0sa8037219873208fdsa3

Second App and Later

DON’T provision your addon. Please set the TREASURE_DATA_API_KEY environment variable as shown below:

$ cd app2_dir
$ heroku config:add TREASURE_DATA_API_KEY='9832dsaf809123808fd0sa8037219873208fdsa3'

Next, please use the td-logger-ruby library or the td-logger-java library to import the data.

NOTE: Sharing API keys is out of scope for the “STDOUT” integration. Even if the Treasure Data API key is changed to point to a different account, the events streamed into stdout are uploaded to the original account.


Last modified: Feb 24 2017 09:27:52 UTC

If this article is incorrect or outdated, or omits critical information, please let us know. For all other issues, please see our support channels.