From ed607ee7d3ca765c65eda23987eed6a41502f09f Mon Sep 17 00:00:00 2001 From: ianedwards Date: Wed, 22 May 2024 15:03:48 -0400 Subject: [PATCH] try updated env file name for vite (#4683) --- .github/actions/build-npm/action.yml | 2 +- .gitignore | 1 + .../main/home/compliance-dashboard/ComplianceContext.tsx | 4 ++-- .../src/main/home/compliance-dashboard/ComplianceContext.tsx | 4 ++-- dashboard/src/shared/auth/ory.ts | 3 +-- dashboard/vite.config.ts | 3 +++ zarf/helm/{.dashboardenv => .envlocal} | 4 ++-- 7 files changed, 12 insertions(+), 9 deletions(-) rename zarf/helm/{.dashboardenv => .envlocal} (79%) diff --git a/.github/actions/build-npm/action.yml b/.github/actions/build-npm/action.yml index 32123d7836..1da1a07dce 100644 --- a/.github/actions/build-npm/action.yml +++ b/.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: | diff --git a/.gitignore b/.gitignore index 5527c6803a..63e7e1f933 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store .env +.env.local docker/.env docker/github_app_private_key.pem app diff --git a/dashboard/src/legacy/main/home/compliance-dashboard/ComplianceContext.tsx b/dashboard/src/legacy/main/home/compliance-dashboard/ComplianceContext.tsx index 8f7918742d..454984527e 100644 --- a/dashboard/src/legacy/main/home/compliance-dashboard/ComplianceContext.tsx +++ b/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) diff --git a/dashboard/src/main/home/compliance-dashboard/ComplianceContext.tsx b/dashboard/src/main/home/compliance-dashboard/ComplianceContext.tsx index 0b938be99c..4aeb9af6fc 100644 --- a/dashboard/src/main/home/compliance-dashboard/ComplianceContext.tsx +++ b/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) diff --git a/dashboard/src/shared/auth/ory.ts b/dashboard/src/shared/auth/ory.ts index db128f27df..daa39afbbd 100644 --- a/dashboard/src/shared/auth/ory.ts +++ b/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({ diff --git a/dashboard/vite.config.ts b/dashboard/vite.config.ts index 31f692b357..e6491118c5 100644 --- a/dashboard/vite.config.ts +++ b/dashboard/vite.config.ts @@ -18,6 +18,9 @@ export default defineConfig(({ mode }) => ({ build: { outDir: "build", }, + ...(mode === "development" && { + envDir: "../zarf/helm", + }), server: { port: 8081, proxy: { diff --git a/zarf/helm/.dashboardenv b/zarf/helm/.envlocal similarity index 79% rename from zarf/helm/.dashboardenv rename to zarf/helm/.envlocal index 595149ecd5..7388010944 100644 --- a/zarf/helm/.dashboardenv +++ b/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"