diff --git a/.env.example b/.env.example index 52a2b02..004c142 100644 --- a/.env.example +++ b/.env.example @@ -1,18 +1,18 @@ # Use the testnet in development -# ALEPH_API_URL=https://api.twentysix.testnet.network +# APP.ALEPH_API_URL=https://api.twentysix.testnet.network # WalletConnect -WALLET_CONNECT_PROJECT_ID= +APP.WALLET_CONNECT_PROJECT_ID= # APIs -LTAI_SUBSCRIPTIONS_API_URL=http://localhost:8000 -LTAI_AGENTS_API_URL=http://localhost:8001 +APP.LTAI_SUBSCRIPTIONS_API_URL=http://localhost:8000 +APP.LTAI_AGENTS_API_URL=http://localhost:8001 # RPCs -SOLANA_RPC= +APP.SOLANA_RPC= # Blockchain addresses (change in development) -# LTAI_BASE_ADDRESS=0x92e1d72210429Ce7eE8a0d64D526D4b9752801FF -# LTAI_SOLANA_ADDRESS=5ooRTqmvm95bHwp4HMo3iszCwsEseY5hksfSa9EDVpBY -# LTAI_PUBLISHER_ADDRESS=0xae92Dc50115dbBb1CF0BA848e83842daf00CE129 -# WAGMI_BASE_ID=84532 +# APP.LTAI_BASE_ADDRESS=0x92e1d72210429Ce7eE8a0d64D526D4b9752801FF +# APP.LTAI_SOLANA_ADDRESS=5ooRTqmvm95bHwp4HMo3iszCwsEseY5hksfSa9EDVpBY +# APP.LTAI_PUBLISHER_ADDRESS=0xae92Dc50115dbBb1CF0BA848e83842daf00CE129 +# APP.WAGMI_BASE_ID=84532 diff --git a/package.json b/package.json index 7ec5e87..1a5c2ab 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,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" diff --git a/quasar.config.js b/quasar.config.js index 22bbc3b..b0f5bd4 100644 --- a/quasar.config.js +++ b/quasar.config.js @@ -10,6 +10,7 @@ const { configure } = require('quasar/wrappers'); const { nodePolyfills } = require('vite-plugin-node-polyfills'); +const EnvironmentPlugin = require('vite-plugin-environment').default; module.exports = configure(function (ctx) { return { @@ -70,7 +71,14 @@ module.exports = configure(function (ctx) { if (viteConf.plugins === undefined) { viteConf.plugins = []; } - viteConf.plugins = [...viteConf.plugins, nodePolyfills()]; + viteConf.plugins = [ + ...viteConf.plugins, + nodePolyfills(), + EnvironmentPlugin('all', { + prefix: 'APP.', + defineOn: 'import.meta.env', + }), + ]; if (ctx.dev) { viteConf.define['process.browser'] = true; } diff --git a/src/boot/utils.ts b/src/boot/utils.ts index 822e077..0833128 100644 --- a/src/boot/utils.ts +++ b/src/boot/utils.ts @@ -2,9 +2,8 @@ import dayjs from 'dayjs'; import localizedFormat from 'dayjs/plugin/localizedFormat'; import relativeTime from 'dayjs/plugin/relativeTime'; import * as pdfjs from 'pdfjs-dist'; -import { boot } from 'quasar/wrappers'; -// @ts-expect-error import workerSrc from 'pdfjs-dist/build/pdf.worker?worker&url'; +import { boot } from 'quasar/wrappers'; export default boot(() => { dayjs.extend(localizedFormat); diff --git a/src/config/env.ts b/src/config/env.ts index 1ecebbf..bf2223f 100644 --- a/src/config/env.ts +++ b/src/config/env.ts @@ -13,6 +13,14 @@ const envSchema = z.object({ WAGMI_BASE_ID: z.union([z.literal(base.id), z.literal(baseSepolia.id)]).default(base.id), }); -const env = envSchema.parse(process.env); +const env = envSchema.parse( + Object.keys(import.meta.env).reduce( + (acc, key) => ({ + ...acc, + ...{ [key.replace('APP.', '')]: import.meta.env[key] }, + }), + {}, + ), +); export default env; diff --git a/tsconfig.json b/tsconfig.json index e579cad..b5294b3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,8 @@ "allowJs": false, "baseUrl": ".", "target": "ESNext", - "skipLibCheck": true + "skipLibCheck": true, + "types": ["node", "vite/client"] }, "exclude": [ "./dist",