mirror of
https://github.com/frontendnetwork/vegancheck.me
synced 2024-11-10 06:24:13 +00:00
feat(Dev): Added Staging Environment
This commit is contained in:
parent
b7675434d5
commit
79b1dfc9ac
7 changed files with 16 additions and 7 deletions
1
.env.development
Normal file
1
.env.development
Normal file
|
@ -0,0 +1 @@
|
||||||
|
NEXT_PUBLIC_STAGING=true
|
1
.env.production
Normal file
1
.env.production
Normal file
|
@ -0,0 +1 @@
|
||||||
|
NEXT_PUBLIC_STAGING=false
|
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
|
@ -43,6 +43,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
|
- name: Setup Production Env
|
||||||
|
run: cp .env.production .env
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f
|
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f
|
||||||
with:
|
with:
|
||||||
|
@ -79,6 +82,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
|
- name: Setup Staging Env
|
||||||
|
run: cp .env.staging .env
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f
|
uses: docker/build-push-action@56932deb0a0db9d23e245320b1e45fec46b8d66f
|
||||||
with:
|
with:
|
||||||
|
|
8
package-lock.json
generated
8
package-lock.json
generated
|
@ -9,7 +9,7 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ericblade/quagga2": "^1.8.2",
|
"@ericblade/quagga2": "^1.8.2",
|
||||||
"@frontendnetwork/vegancheck": "1.1.26",
|
"@frontendnetwork/vegancheck": "^1.1.31",
|
||||||
"@socialgouv/matomo-next": "^1.6.1",
|
"@socialgouv/matomo-next": "^1.6.1",
|
||||||
"@types/node": "20.4.5",
|
"@types/node": "20.4.5",
|
||||||
"@types/react-dom": "18.2.7",
|
"@types/react-dom": "18.2.7",
|
||||||
|
@ -1894,9 +1894,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@frontendnetwork/vegancheck": {
|
"node_modules/@frontendnetwork/vegancheck": {
|
||||||
"version": "1.1.26",
|
"version": "1.1.31",
|
||||||
"resolved": "https://registry.npmjs.org/@frontendnetwork/vegancheck/-/vegancheck-1.1.26.tgz",
|
"resolved": "https://registry.npmjs.org/@frontendnetwork/vegancheck/-/vegancheck-1.1.31.tgz",
|
||||||
"integrity": "sha512-6TRIHwK0ErMpKKaAOc0zkIReOg29xXn3wxNH3sJQINlj7vqyfg/Hai6lkKVaZHxkqdJkaG0rwZEk+GfjO42hyg=="
|
"integrity": "sha512-D2sFFtI/GXfUpCT6r35sGgcbKYWjTtLpMRspSVMh5cRBfUTn+hdqP2UH0PyvGuTf4qDkmFyq4Yst83MWh0rYGQ=="
|
||||||
},
|
},
|
||||||
"node_modules/@humanwhocodes/config-array": {
|
"node_modules/@humanwhocodes/config-array": {
|
||||||
"version": "0.11.10",
|
"version": "0.11.10",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ericblade/quagga2": "^1.8.2",
|
"@ericblade/quagga2": "^1.8.2",
|
||||||
"@frontendnetwork/vegancheck": "1.1.26",
|
"@frontendnetwork/vegancheck": "^1.1.31",
|
||||||
"@socialgouv/matomo-next": "^1.6.1",
|
"@socialgouv/matomo-next": "^1.6.1",
|
||||||
"@types/node": "20.4.5",
|
"@types/node": "20.4.5",
|
||||||
"@types/react-dom": "18.2.7",
|
"@types/react-dom": "18.2.7",
|
||||||
|
|
|
@ -64,7 +64,8 @@ const ProductSearch: React.FC = () => {
|
||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
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);
|
setLoading(false);
|
||||||
if (data.status === 200) {
|
if (data.status === 200) {
|
||||||
setResult(data.product);
|
setResult(data.product);
|
||||||
|
|
|
@ -28,7 +28,7 @@ const IngredientsCheck = () => {
|
||||||
const checkIngredients = async () => {
|
const checkIngredients = async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
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") {
|
if (data.data.vegan === "false") {
|
||||||
setVegan(false);
|
setVegan(false);
|
||||||
setFlagged(data.data.flagged);
|
setFlagged(data.data.flagged);
|
||||||
|
|
Loading…
Reference in a new issue