Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot setup enviroment variables for instagram_basic_display #6

Closed
elinachar opened this issue Jul 26, 2020 · 2 comments
Closed

Cannot setup enviroment variables for instagram_basic_display #6

elinachar opened this issue Jul 26, 2020 · 2 comments

Comments

@elinachar
Copy link

Hi,
As Instagram changed their API Permissions lately, I am trying to implement the Instagram Basic Display API at one of my Ruby on Rails websites. I have already manually get my first long-lived access token and the next step is to get the media from instagram and find a way to automatically update the long-lived access token within the app. I found your article at ConvertKit really helpful and interesting. I installed your instagram_basic_display gem and tried to follow the guidelines here at github but obviously I face a problem on setting the enviroment variables. Could you please be more specific in which file exactly the enviroment variables should be saved and how it should look like?

Thank you in advance,
Elina

@raquelxmoss
Copy link
Collaborator

Hi Elina,

You can set environment variables in Ruby apps in several ways:

  • You can set them in your terminal with export MY_VARIABLE=my_value. Keep in mind that those variables will be stored in your bash history, so you might want to periodically clear them out so that you're not storing sensitive information in your history.

  • You can define your variables when starting your server. For example, in a Rails application: MY_VARIABLE=my_value rails s. Again, that will stay in your bash history, so be careful to clear your bash history to remove the sensitive variables.

  • You can use a gem to pick up environment variables. Usually, I use the dotenv gem so that I can set environment variables for different environments in different files (e.g. .env.development for development and .env.production for production). I suggest taking a look at that gem. You would then create a .env file that contains the instagram variables.

If you would prefer another way to set the variables (perhaps just passed into the configuration), you are welcome to create a PR to do that!

@elinachar
Copy link
Author

elinachar commented Jul 27, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants