Urigo / WhatsApp-Clone-Tutorial

https://www.tortilla.academy/Urigo/WhatsApp-Clone-Tutorial
https://tortilla.academy
565 stars 144 forks source link

Step 15 Use environmental variables for the Unsplash API key #70

Open reymon359 opened 4 years ago

reymon359 commented 4 years ago

I think it should be a nice thing to explain to the user what are Environmental Variables and how to create and use a .env file in the application and change the current way the Unsplash API key it's used

headers: {
  Authorization:
    'Client-ID 4d048cfb4383b407eff92e4a2a5ec36c0a866be85e64caafa588c110efad350d',
},

EDIT This course is so extensive and full of teachings that I forgot that the .env file is actually explained in Step 3 > Client 3.1 So maybe just create one for the server and add the Unsplash API key to it?

Urigo commented 4 years ago

@reymon359 are you up for a PR to change it how you see fit?

reymon359 commented 4 years ago

Sure, I could find some time and work on it!

I was thinking of changing it to:

headers: {
  Authorization:
    `Client-ID ${process.env.UNSPLASH_ACCESS_KEY}`,
},

Although it could also be added in the env.ts file and then import it here.

What do you think?

Urigo commented 4 years ago

mmmm not sure, I'll leave it to your call!

reymon359 commented 4 years ago

Hi there! Sorry for the late response but I have been quite busy the last weeks. I submitted a pull request #84 to implement it. I tried to change the code too but when I click the submit button I am being redirected to a not working link.

I opened an issue to take it into account #85

Screenshot 2020-06-25 at 20 34 16

Screenshot 2020-06-25 at 20 25 34