gethypervisual / gridsome-plugin-netlify-cms

Gridsome.js plugin to include Netlify CMS
Other
15 stars 9 forks source link

Manual Init option #6

Open Guitouxx opened 5 years ago

Guitouxx commented 5 years ago

Hi,

I would like to know if it's possible to initialize manually the netlify CMS through the Gridsome plugin : https://www.netlifycms.org/docs/beta-features/#manual-initialization

In the Gatsby plugin, there is a manualInit option which can let us to override the config.yml file: https://www.gatsbyjs.org/packages/@emanueleperuffo/gatsby-plugin-netlify-cms/#manualinit

My goal is to hide the API of my gitlab account and the api of my cloudinary account by puting them in a .env file. The config.yml is easily readable from the browser, so everyone can read these datas...

Btw, is it possible to access the process.env object in the module file for the netlify CMS?

Thanks for your help guys !!

tobymarsden commented 5 years ago

@Guitouxx Good idea!

However, Netlify CMS runs in the browser, so it won't be able to access a .env file; you have to export your Cloudinary public key (but not your API secret!) in config.yml. Likewise, the module is executed in the browser so it doesn't have access to process.env.

With GitLab, you'll be accessing your GitLab account via GitLab OAuth2 or the Git Gateway -- you shouldn't be putting any sensitive credentials into config.yml: see Authentication Backends.

Guitouxx commented 5 years ago

@tobymarsden You're right. I shouldn't put any credential in config.yml and I noticed that the cloudinary widget isn't accessible if the user is not logged in the cloudinary website !!