1

I'm trying to set an auth token for my gemfile to access a private git repo. i.e.

gem 'mygem', git: "https://ENV['GITHUB_AUTH_TOKEN']:x-oauth-basic@github.com/my_account/my_repo.git", tag: "0.0.1"

I can't work out how to store this in Figaro but make it accessible to bundle when I run bundle install.

Very similar to This question

Except that rather than having a config/heroku_env.rb I have an config/application.yml file.

I'm sure the answer is ridiculously straightforward.

I'd like to keep it in that file as it keeps everything neatly in one place, but if not I can put it somewhere specific so long as it lines up with heroku nicely.

Any ideas?

Community
  • 1
  • 1
Carpela
  • 2,155
  • 1
  • 24
  • 55

2 Answers2

1

I have found one way to do it that works, it's slightly annoying in that you have to keep the credentials in two different places.

.bundle

BUNDLE_GITHUB__COM: <auth_token>:x-oauth-basic

Gemfile

gem 'mygem', git: "https://github.com/my_account/my_repo.git", tag: "0.0.1"
# Note that you don't put anything in here, bundler sorts it out automagically

And then

heroku config:set BUNDLE_GITHUB__COM=<auth_token>:x-oauth-basic

Works. Annoying because now application.yml has different content to my heroku file. But so be it.

Update:

Better solution

Just put

BUNDLE_GITHUB__COM: <auth_token>:x-oauth-basic

into both your application.yml and heroku config.

I wish someone had documented that somewhere, would have saved me a ton of trouble...

Carpela
  • 2,155
  • 1
  • 24
  • 55
0

I think you need to run

figaro heroku:set -e production

for it to set set the environment variables in your config/application.yml file as Heroku environment variables.

Jeremie
  • 2,241
  • 2
  • 17
  • 25
  • That's not the problem. The issue is that even locally the gemfile is not picking up the auth variable that I've stored in the application.yml. – Carpela Apr 07 '17 at 08:49