Ver código fonte

try updated env file name for vite (#4683)

ianedwards 2 anos atrás
pai
commit
ed607ee7d3

+ 1 - 1
.github/actions/build-npm/action.yml

@@ -22,7 +22,7 @@ runs:
       shell: bash
       run: |
         touch dashboard/.env
-        echo '${{ inputs.env_vars }}' > dashboard/.env
+        echo '${{ inputs.env_vars }}' > dashboard/.env.production
     - name: Run NPM Build
       shell: bash
       run: |

+ 1 - 0
.gitignore

@@ -1,5 +1,6 @@
 .DS_Store
 .env
+.env.local
 docker/.env
 docker/github_app_private_key.pem
 app

+ 2 - 2
dashboard/src/legacy/main/home/compliance-dashboard/ComplianceContext.tsx

@@ -121,8 +121,8 @@ export const ProjectComplianceProvider: React.FC<
         return;
       }
 
-      const cidrAllowList = import.meta.env.PORTER_CIDRS
-        ? import.meta.env.PORTER_CIDRS.split(",")
+      const cidrAllowList = import.meta.env.VITE_PORTER_CIDRS
+        ? import.meta.env.VITE_PORTER_CIDRS.split(",")
         : [];
 
       const updatedKindValues = match(latestContractProto.cluster.kindValues)

+ 2 - 2
dashboard/src/main/home/compliance-dashboard/ComplianceContext.tsx

@@ -123,8 +123,8 @@ export const ProjectComplianceProvider: React.FC<
         return;
       }
 
-      const cidrAllowList = import.meta.env.PORTER_CIDRS
-        ? import.meta.env.PORTER_CIDRS.split(",")
+      const cidrAllowList = import.meta.env.VITE_PORTER_CIDRS
+        ? import.meta.env.VITE_PORTER_CIDRS.split(",")
         : [];
 
       const updatedKindValues = match(latestContractProto.cluster.kindValues)

+ 1 - 2
dashboard/src/shared/auth/ory.ts

@@ -4,8 +4,7 @@ import { Configuration, FrontendApi } from "@ory/client";
 import { type AxiosError } from "axios";
 import { useHistory } from "react-router-dom";
 
-export const basePath =
-  import.meta.env.REACT_APP_ORY_URL || "http://localhost:4000";
+export const basePath = import.meta.env.VITE_ORY_URL || "http://localhost:4000";
 
 export const ory = new FrontendApi(
   new Configuration({

+ 3 - 0
dashboard/vite.config.ts

@@ -18,6 +18,9 @@ export default defineConfig(({ mode }) => ({
   build: {
     outDir: "build",
   },
+  ...(mode === "development" && {
+    envDir: "../zarf/helm",
+  }),
   server: {
     port: 8081,
     proxy: {

+ 2 - 2
zarf/helm/.dashboardenv → zarf/helm/.envlocal

@@ -20,7 +20,7 @@ API_SERVER=http://localhost:8080
 
 TRUST_ARN=arn:aws:iam::MY_AWS_DEV_ACCOUNT_ID:role/CAPIManagement
 
-# PORTER_CIDRS are a comma-separated list of CIDRs mapping to Porter infra. Used for restricting access to a customer's control plane endpoint
+# VITE_PORTER_CIDRS are a comma-separated list of CIDRs mapping to Porter infra. Used for restricting access to a customer's control plane endpoint
 # below example is for the office IP
-PORTER_CIDRS="135.84.167.61/32"
+VITE_PORTER_CIDRS="135.84.167.61/32"