kontent-ai / sample-app-vue

A sample website written in JavaScript and Vue utilizing the Kontent.ai Delivery API to manage and retrieve content.
https://kontent-sample-app-vue.netlify.app
MIT License
24 stars 36 forks source link

Extract API keys definition to .env #23

Closed Simply007 closed 5 years ago

Simply007 commented 5 years ago

Motivation

According to https://github.com/Kentico/cloud-sample-app-vue/pull/19#issuecomment-439697464 - it is easily possible to commit API keys as a part of the pull request in Client.js file.

Currently, it is possible to configure the project :

When you configure your project manually it is required to temporarilly change the source code in Client.js file and that could leads to commit this unintended change that was used for, let's say testing purposes.

If the project ID was loaded from environment, as an environment variable, it would eliminate possibility for unintended commit to Client.js. Loading environment variables is possible utins dotenv library.

Proposed solution

Best practice nowadays is to use environment variables stored in .env file.

Additional context

BachAmadou commented 5 years ago

@simply007, thanks you. Will keep you up to date