Closed elinachar closed 4 years ago
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!
Hi Raquel,
Thank you very much for your prompt response. It really helped me to solve the problem.
Kind regards, Elina
On Sun, Jul 26, 2020 at 1:56 PM Raquel Moss notifications@github.com wrote:
Closed #6 https://github.com/ConvertKit/instagram_basic_display/issues/6 .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ConvertKit/instagram_basic_display/issues/6#event-3586977958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIZHLR5UH56FJCZAWIILWULR5QDWJANCNFSM4PH5KYQQ .
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