DEV Community

Discussion on: Hide your API Keys with Netlify Functions

Collapse
 
jftidwell profile image
jftidwell

"I like to put all the things related to Netlify inside a folder called .netlify. Inside that .netlify folder I just created another folder called functions."

I am unable to get git to recognize the ".netlify" folder, so it will never push to to netlify. Any thoughts here?

Collapse
 
lawrencejohnson profile image
Lawrence

Check gitignore documentation in regards to the folder being ignored by git, but as a general rule anything with . in front of it is considered hidden in most OS environments. In other words, you wouldn't want to put anything in a folder like that unless you truly wanted it hidden from everything except the local environment its stored in (generally speaking).

Collapse
 
jftidwell profile image
jftidwell

Thanks for replying. Maybe I am just misunderstanding how creating this locally, then NOT pushing it to the repo will result in this working somehow.

Thread Thread
 
fabiorosado profile image
Fabio Rosado

Hello I think you might have misunderstand - or I haven't explained myself well on the post. You will need to push .netlify folder to your repo. All your api keys should be environmental variables which will be set on netlify website.

That way netlify will get your keys server side when running your server-side function. If you can't make netlify discover that folder make sure that this folder is located in the root of your project and in netlify functions tab you wrote the full path './netlify/functions'

Hope this helps

Thread Thread
 
jftidwell profile image
jftidwell

'./netlify/functions' instead of '.netlify/functions'
This seems to have been the issue. thanks!