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.
Set up .gitignore to ignore .env file
Configure Client.js to use .env definition for keys (projectId and previewApiKey)
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.
Client.js
to use .env definition for keys (projectId and previewApiKey)Additional context