Skip to content

Commit 79b1dfc

Browse files
feat(Dev): Added Staging Environment
1 parent b767543 commit 79b1dfc

File tree

7 files changed

+16
-7
lines changed

7 files changed

+16
-7
lines changed

.env.development

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_STAGING=true

.env.production

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_STAGING=false

.github/workflows/build.yml

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
with:
4444
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4545

46+
- name: Setup Production Env
47+
run: cp .env.production .env
48+
4649
- name: Build and push Docker image
4750
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f
4851
with:
@@ -79,6 +82,9 @@ jobs:
7982
with:
8083
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
8184

85+
- name: Setup Staging Env
86+
run: cp .env.staging .env
87+
8288
- name: Build and push Docker image
8389
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f
8490
with:

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"dependencies": {
1414
"@ericblade/quagga2": "^1.8.2",
15-
"@frontendnetwork/vegancheck": "1.1.26",
15+
"@frontendnetwork/vegancheck": "^1.1.31",
1616
"@socialgouv/matomo-next": "^1.6.1",
1717
"@types/node": "20.4.5",
1818
"@types/react-dom": "18.2.7",

src/components/check.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ const ProductSearch: React.FC = () => {
6464

6565
setLoading(true);
6666
try {
67-
const data = await VeganCheck.getProductByBarcode(barcode);
67+
console.warn(process.env.NEXT_PUBLIC_STAGING);
68+
const data = await VeganCheck.getProductByBarcode(barcode, process.env.NEXT_PUBLIC_STAGING === "true" ? true : false);
6869
setLoading(false);
6970
if (data.status === 200) {
7071
setResult(data.product);

src/components/ingredientscheck.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const IngredientsCheck = () => {
2828
const checkIngredients = async () => {
2929
setLoading(true);
3030
try {
31-
const data = await VeganCheck.checkIngredientsList(ingredients.value);
31+
const data = await VeganCheck.checkIngredientsList(ingredients.value, process.env.NEXT_PUBLIC_STAGING === "true" ? true : false);
3232
if (data.data.vegan === "false") {
3333
setVegan(false);
3434
setFlagged(data.data.flagged);

0 commit comments

Comments
 (0)