From d43ece246a3d1acebc709f65341c19883fc87156 Mon Sep 17 00:00:00 2001 From: Reza Rahemtola Date: Tue, 10 Dec 2024 16:03:08 +0900 Subject: [PATCH] fix: Env working locally and in prod --- .env.example | 18 +++++++++--------- package-lock.json | 11 +++++++++++ quasar.config.js | 5 +---- src/config/env.ts | 10 +--------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.env.example b/.env.example index 004c142..52a2b02 100644 --- a/.env.example +++ b/.env.example @@ -1,18 +1,18 @@ # Use the testnet in development -# APP.ALEPH_API_URL=https://api.twentysix.testnet.network +# ALEPH_API_URL=https://api.twentysix.testnet.network # WalletConnect -APP.WALLET_CONNECT_PROJECT_ID= +WALLET_CONNECT_PROJECT_ID= # APIs -APP.LTAI_SUBSCRIPTIONS_API_URL=http://localhost:8000 -APP.LTAI_AGENTS_API_URL=http://localhost:8001 +LTAI_SUBSCRIPTIONS_API_URL=http://localhost:8000 +LTAI_AGENTS_API_URL=http://localhost:8001 # RPCs -APP.SOLANA_RPC= +SOLANA_RPC= # Blockchain addresses (change in development) -# APP.LTAI_BASE_ADDRESS=0x92e1d72210429Ce7eE8a0d64D526D4b9752801FF -# APP.LTAI_SOLANA_ADDRESS=5ooRTqmvm95bHwp4HMo3iszCwsEseY5hksfSa9EDVpBY -# APP.LTAI_PUBLISHER_ADDRESS=0xae92Dc50115dbBb1CF0BA848e83842daf00CE129 -# APP.WAGMI_BASE_ID=84532 +# LTAI_BASE_ADDRESS=0x92e1d72210429Ce7eE8a0d64D526D4b9752801FF +# LTAI_SOLANA_ADDRESS=5ooRTqmvm95bHwp4HMo3iszCwsEseY5hksfSa9EDVpBY +# LTAI_PUBLISHER_ADDRESS=0xae92Dc50115dbBb1CF0BA848e83842daf00CE129 +# WAGMI_BASE_ID=84532 diff --git a/package-lock.json b/package-lock.json index 171b942..f080db2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,6 +63,7 @@ "tailwindcss": "^3.4.14", "typescript": "^5.6.3", "vite-plugin-checker": "^0.7.2", + "vite-plugin-environment": "^1.1.3", "vite-plugin-node-polyfills": "^0.22.0", "vue-eslint-parser": "^9.4.3", "vue-tsc": "^2.0.29" @@ -19277,6 +19278,16 @@ "node": ">= 12" } }, + "node_modules/vite-plugin-environment": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/vite-plugin-environment/-/vite-plugin-environment-1.1.3.tgz", + "integrity": "sha512-9LBhB0lx+2lXVBEWxFZC+WO7PKEyE/ykJ7EPWCq95NEcCpblxamTbs5Dm3DLBGzwODpJMEnzQywJU8fw6XGGGA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "vite": ">= 2.7" + } + }, "node_modules/vite-plugin-node-polyfills": { "version": "0.22.0", "dev": true, diff --git a/quasar.config.js b/quasar.config.js index b0f5bd4..04b86c0 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -74,10 +74,7 @@ module.exports = configure(function (ctx) { viteConf.plugins = [ ...viteConf.plugins, nodePolyfills(), - EnvironmentPlugin('all', { - prefix: 'APP.', - defineOn: 'import.meta.env', - }), + EnvironmentPlugin('all', { defineOn: 'import.meta.env' }), ]; if (ctx.dev) { viteConf.define['process.browser'] = true; diff --git a/src/config/env.ts b/src/config/env.ts index bf2223f..3f52b14 100644 --- a/src/config/env.ts +++ b/src/config/env.ts @@ -13,14 +13,6 @@ const envSchema = z.object({ WAGMI_BASE_ID: z.union([z.literal(base.id), z.literal(baseSepolia.id)]).default(base.id), }); -const env = envSchema.parse( - Object.keys(import.meta.env).reduce( - (acc, key) => ({ - ...acc, - ...{ [key.replace('APP.', '')]: import.meta.env[key] }, - }), - {}, - ), -); +const env = envSchema.parse(import.meta.env); export default env;