Add environment plugin to change from import meta env to process env

This commit is contained in:
RcleydsonR
2023-01-24 18:48:13 -03:00
parent 65fc11a64f
commit 8b5ba69267
7 changed files with 18 additions and 11 deletions

View File

@@ -27,8 +27,8 @@ const getProviderUrl = (): string => {
const etherStore = useEtherStore();
const possibleProvidersUrls: { [key: string]: string } = {
Ethereum: import.meta.env.VITE_GOERLI_API_URL,
Polygon: import.meta.env.VITE_MUMBAI_API_URL,
Ethereum: process.env.VITE_GOERLI_API_URL ? process.env.VITE_GOERLI_API_URL : "",
Polygon: process.env.VITE_MUMBAI_API_URL ? process.env.VITE_MUMBAI_API_URL : "",
};
return possibleProvidersUrls[etherStore.networkName];

View File

@@ -11,14 +11,14 @@ const getNetworksLiquidity = async (): Promise<void> => {
console.log("Loading events");
const goerliProvider = new ethers.providers.JsonRpcProvider(
import.meta.env.VITE_GOERLI_API_URL,
process.env.VITE_GOERLI_API_URL,
5
); // goerli provider
const mumbaiProvider = new ethers.providers.JsonRpcProvider(
import.meta.env.VITE_MUMBAI_API_URL,
process.env.VITE_MUMBAI_API_URL,
80001
); // mumbai provider
const p2pContractGoerli = new ethers.Contract(
"0x5f3EFA9A90532914545CEf527C530658af87e196",
p2pix.abi,
@@ -29,7 +29,7 @@ const getNetworksLiquidity = async (): Promise<void> => {
p2pix.abi,
mumbaiProvider
);
const depositListGoerli = await getValidDeposits(p2pContractGoerli);
const depositListMumbai = await getValidDeposits(p2pContractMumbai);
@@ -55,7 +55,7 @@ const getValidDeposits = async (
const filterDeposits = p2pContract.filters.DepositAdded(null);
const eventsDeposits = await p2pContract.queryFilter(filterDeposits);
p2pContract = getContract(); // get metamask provider contract
if(!contract) p2pContract = getContract(); // get metamask provider contract
const depositList = await Promise.all(
eventsDeposits.map(async (deposit) => {

View File

@@ -5,7 +5,7 @@ import ManageBidsView from "../views/ManageBidsView.vue";
import SellerView from "@/views/SellerView.vue";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
history: createWebHistory(process.env.BASE_URL),
routes: [
{
path: "/",

View File

@@ -8,7 +8,7 @@ const defaultConfig = {
const api = axios.create({
...defaultConfig,
baseURL: import.meta.env.VITE_API_URL,
baseURL: process.env.VITE_API_URL,
});
export default api;