feat(Dev): Added Staging Environment

This commit is contained in:
Philip 2023-08-15 16:50:38 +02:00
parent b7675434d5
commit 79b1dfc9ac
7 changed files with 16 additions and 7 deletions

1
.env.development Normal file
View file

@ -0,0 +1 @@
NEXT_PUBLIC_STAGING=true

1
.env.production Normal file
View file

@ -0,0 +1 @@
NEXT_PUBLIC_STAGING=false

View file

@ -43,6 +43,9 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Setup Production Env
run: cp .env.production .env
- name: Build and push Docker image
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f
with:
@ -79,6 +82,9 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Setup Staging Env
run: cp .env.staging .env
- name: Build and push Docker image
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f
with:

8
package-lock.json generated
View file

@ -9,7 +9,7 @@
"version": "0.1.0",
"dependencies": {
"@ericblade/quagga2": "^1.8.2",
"@frontendnetwork/vegancheck": "1.1.26",
"@frontendnetwork/vegancheck": "^1.1.31",
"@socialgouv/matomo-next": "^1.6.1",
"@types/node": "20.4.5",
"@types/react-dom": "18.2.7",
@ -1894,9 +1894,9 @@
}
},
"node_modules/@frontendnetwork/vegancheck": {
"version": "1.1.26",
"resolved": "https://registry.npmjs.org/@frontendnetwork/vegancheck/-/vegancheck-1.1.26.tgz",
"integrity": "sha512-6TRIHwK0ErMpKKaAOc0zkIReOg29xXn3wxNH3sJQINlj7vqyfg/Hai6lkKVaZHxkqdJkaG0rwZEk+GfjO42hyg=="
"version": "1.1.31",
"resolved": "https://registry.npmjs.org/@frontendnetwork/vegancheck/-/vegancheck-1.1.31.tgz",
"integrity": "sha512-D2sFFtI/GXfUpCT6r35sGgcbKYWjTtLpMRspSVMh5cRBfUTn+hdqP2UH0PyvGuTf4qDkmFyq4Yst83MWh0rYGQ=="
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.10",

View file

@ -12,7 +12,7 @@
},
"dependencies": {
"@ericblade/quagga2": "^1.8.2",
"@frontendnetwork/vegancheck": "1.1.26",
"@frontendnetwork/vegancheck": "^1.1.31",
"@socialgouv/matomo-next": "^1.6.1",
"@types/node": "20.4.5",
"@types/react-dom": "18.2.7",

View file

@ -64,7 +64,8 @@ const ProductSearch: React.FC = () => {
setLoading(true);
try {
const data = await VeganCheck.getProductByBarcode(barcode);
console.warn(process.env.NEXT_PUBLIC_STAGING);
const data = await VeganCheck.getProductByBarcode(barcode, process.env.NEXT_PUBLIC_STAGING === "true" ? true : false);
setLoading(false);
if (data.status === 200) {
setResult(data.product);

View file

@ -28,7 +28,7 @@ const IngredientsCheck = () => {
const checkIngredients = async () => {
setLoading(true);
try {
const data = await VeganCheck.checkIngredientsList(ingredients.value);
const data = await VeganCheck.checkIngredientsList(ingredients.value, process.env.NEXT_PUBLIC_STAGING === "true" ? true : false);
if (data.data.vegan === "false") {
setVegan(false);
setFlagged(data.data.flagged);