edu222
edu222

Reputation: 496

GIT/Heroku sensitive info

I have a django project deployed in Heroku. It uses python-instragram.

I have a 'client secret' from an instragram client that I have. I use git/github for version control.

This client_secret is imported from an untracked file because I don't want to have it on my public github repo. I do something like this:

from core_keys import core_client_secret

CONFIG = {
'client_id': '83d1b794dfc24f5588378f88be67c586',
'client_secret': core_client_secret,
'redirect_uri': 'http://localhost:8515/oauth_callback'
}
api = client.InstagramAPI(**CONFIG)

I have core_keys.py added to .gitignore:

*/core_keys.py

When I deploy to heroku the app doesn't work obviously because the file that contains the client_secret was not pushed to heroku since it's in .gitignore.

How can I have this file on heroku without the need for a private repo, what approach should I use?

Upvotes: 0

Views: 162

Answers (2)

edu222
edu222

Reputation: 496

Just as a reference, ended up doing this:

On the terminal at my development machine:

heroku config:set INSTAGRAMSECRET=00000FFFFF

On the file where I need the environment var inside of Heroku:

import os
insta_secret = os.environ['INSTAGRAMSECRET']

Upvotes: 0

friism
friism

Reputation: 19279

You should store the secrets as config vars in the environment.

Upvotes: 3

Related Questions