Closed doubleZ0108 closed 4 years ago
Hey @doubleZ0108,
this starter provides the environment variables via the .env
file which is created in the setup step. These variables hold the configuration to build the site.
For the contentful case, this is the space id and the CDA/CPA token. To deploy this site to netlify you have to define these variables in their environment, because the .env
file is not checked into git. It is common practice to have sensitive information in your environment variables (tokens, hidden URLs, ...) so you should be very careful with these. That's why the .env
file is usually defined in .gitignore
.
To deploy this starter to Netlify you have to define these variables in their environment. You can do that under the environment deploy setting of your site.
The variables should be the same as the ones defined in your .env
file.
The variables (no matter if defined in .env
or on Netlify) will be available via process.env
. This is what this starter uses to build the site. :)
I hope that helps. :) Let me know if you have further questions. :)
Thanks really really much for your resolution. I will read it carefully later. And if I still have some question I will ask you later. Thank you again
—————————————————— Thanks and Regards Tongji University Zhe Zhang
2020年5月4日 18:39,Stefan Judis notifications@github.com 写道:
Hey @doubleZ0108 https://github.com/doubleZ0108,
this starter provides the environment variables https://medium.com/chingu/an-introduction-to-environment-variables-and-how-to-use-them-f602f66d15fa via the .env file which is created in the setup step. These variables hold the configuration to build the site.
For the contentful case, this is the space id and the CDA/CPA token. To deploy this site to netlify you have to define these variables in their environment, because the .env file is not checked into git. It is common practice to have sensitive information in your environment variables (tokens, hidden URLs, ...) so you should be very careful with these. That's why the .env file is usually defined in .gitignore.
To deploy this starter to Netlify you have to define these variables in their environment. You can do that under the environment deploy setting of your site.
https://user-images.githubusercontent.com/962099/80957604-c76bd380-8e03-11ea-836d-6c5c2536321b.png The variables should be the same as the ones defined in your .env file.
https://user-images.githubusercontent.com/962099/80957664-ee2a0a00-8e03-11ea-9809-81d05fafa2af.png The variables (no matter if defined in .env or on Netlify) will be available via process.env. This is what this starter uses to build the site. :)
I hope that helps. :) Let me know if you have further questions. :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/contentful-userland/gatsby-contentful-starter/issues/75#issuecomment-623389170, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJJS2VOJPXZ5VQM3SO5T3L3RP2LN5ANCNFSM4MXFROWA.
The starter is awesome, but I want to know how to auto deploy it to Netlify. When I auto deploy, I should input my Space ID and so on. I just don't know how to do this. Thank you advanced.