Skip to content

Commit 41881ff

Browse files
committed
feat(app): enable env vars
1 parent 8975f82 commit 41881ff

File tree

6 files changed

+24
-6
lines changed

6 files changed

+24
-6
lines changed

packages/app/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VITE_POD_URL="localhost:3000"
2+
VITE_CONTRACT_ID="0xd72ac19567088e35a446e0dacdfadc5f266ea68d2481401d9e6b374310fac3de"

packages/app/README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,33 @@ Here's a brief overview of the structure:
2929
## Installation
3030
-----------------
3131

32+
### Environments
33+
-----------------
34+
```bash
35+
## This is the URL of the API-Gramine, the gramine api
36+
VITE_POD_URL="localhost:3000"
37+
## Pod validator address
38+
VITE_CONTRACT_ID="0xd72ac19567088e35a446e0dacdfadc5f266ea68d2481401d9e6b374310fac3de"
39+
```
40+
3241
#### Steps
3342
1) Clone the repository:
3443
```bash
3544
$ gh repo clone hack-a-chain-software/bazk
3645
$ cd bazk
3746
```
3847

39-
2) Install frontend dependencies via YARN:
48+
2) Configure enviroments
49+
```bash
50+
$ cp ./app/.env.example ./app/.env
51+
```
52+
53+
3) Install frontend dependencies via YARN:
4054
```bash
4155
$ yarn install
4256
```
4357

44-
3) Run dev server
58+
4) Run dev server
4559
```bash
4660
$ yarn app dev
4761
```

packages/app/src/machines/CeremoniesMachine.ts

Whitespace-only changes.

packages/app/src/machines/actors/contract.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ const BAZK_CONTRACT_ID = '0xd72ac19567088e35a446e0dacdfadc5f266ea68d2481401d9e6b
66

77
export const contractConnection = fromPromise(
88
async ({ input }: any) => {
9+
const address = import.meta.env.VITE_CONTRACT_ID || BAZK_CONTRACT_ID
10+
911
const { connection, phatRegistry } = input
1012

11-
const contractKey = await phatRegistry.getContractKeyOrFail(BAZK_CONTRACT_ID)
13+
const contractKey = await phatRegistry.getContractKeyOrFail(address)
1214

13-
const contract = new PinkContractPromise(connection, phatRegistry, abi, BAZK_CONTRACT_ID, contractKey)
15+
const contract = new PinkContractPromise(connection, phatRegistry, abi, address, contractKey)
1416

1517
return {
1618
contract,

packages/app/src/pages/ceremony/Create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const CreatePage = () => {
102102
console.log("Creating ceremony with params: ", data)
103103

104104
try {
105-
const response = await fetch(apiUrl, {
105+
const response = await fetch(import.meta.env.VITE_POD_URL || apiUrl, {
106106
method: 'POST',
107107
headers: {
108108
'Content-Type': 'application/json',

packages/app/src/pages/ceremony/[id]/contribute/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const CreateContributionPage = () => {
7373
};
7474

7575
try {
76-
const response = await fetch(apiUrl, {
76+
const response = await fetch(import.meta.env.VITE_POD_URL || apiUrl, {
7777
method: 'POST',
7878
headers: {
7979
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)