Skip to content

Commit

Permalink
Add prod building with no local wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
lindlof committed Dec 6, 2020
1 parent 7bdf302 commit 9e7b3e3
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 18 deletions.
2 changes: 1 addition & 1 deletion script/react.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ export REACT_APP_CHAIN_NAME="Secret localhost"
export REACT_APP_LCD_URL=http://localhost:1338
export REACT_APP_RPC_URL=http://localhost:26657
export REACT_APP_CONTRACT="$CONTRACT"
docker-compose up --build
docker-compose up -f docker-development.yaml --build
2 changes: 2 additions & 0 deletions web/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REACT_APP_FAUCET=https://faucet.secrettestnet.io/
REACT_APP_ENABLE_LOCAL_WALLET=true
8 changes: 8 additions & 0 deletions web/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
REACT_APP_CHAIN_ID=secret-2
REACT_APP_SUGGEST_CHAIN=false
REACT_APP_CHAIN_NAME=Secret Network
REACT_APP_LCD_URL=https://secretapi.io
REACT_APP_RPC_URL=http://secretapi.io:26657
REACT_APP_CONTRACT=secret17c7j5xgylhty8jq5lqnuaqd68ndazs022mqcuu
REACT_APP_FAUCET=
REACT_APP_ENABLE_LOCAL_WALLET=false
1 change: 1 addition & 0 deletions web/.env → web/.env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ REACT_APP_LCD_URL=https://bootstrap.secrettestnet.io
REACT_APP_RPC_URL=http://bootstrap.secrettestnet.io:26657
REACT_APP_CONTRACT=secret17c7j5xgylhty8jq5lqnuaqd68ndazs022mqcuu
REACT_APP_FAUCET=https://faucet.secrettestnet.io/
REACT_APP_ENABLE_LOCAL_WALLET=true
11 changes: 11 additions & 0 deletions web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Secret Rock Paper Scissors Frontend

Rock paper scissors game secret frontend for Secret Network.

## Testnet build

docker-compose -f docker-testnet.yaml up --build

## Production build

docker-compose -f docker-production.yaml up --build
14 changes: 0 additions & 14 deletions web/docker-build.yaml

This file was deleted.

File renamed without changes.
8 changes: 8 additions & 0 deletions web/docker-production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.8'
services:
web:
build:
context: .
command: ['npm', 'run', 'build:production']
volumes:
- './build/:/app/build'
8 changes: 8 additions & 0 deletions web/docker-testnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.8'
services:
web:
build:
context: .
command: ['npm', 'run', 'build:testnet']
volumes:
- './build/:/app/build'
129 changes: 129 additions & 0 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"scripts": {
"start": "react-scripts start",
"build:testnet": "env-cmd -f .env.testnet react-scripts build",
"build": "react-scripts build",
"test": "react-scripts test"
},
Expand All @@ -39,6 +40,7 @@
"@types/node": "^14.14.0",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"env-cmd": "^10.1.0",
"prettier": "^2.1.2"
}
}
2 changes: 2 additions & 0 deletions web/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface Config {
readonly rpcUrl: string;
readonly contract: string;
readonly faucetUrl: string | undefined;
readonly enableLocalWallet: boolean;
}

const envConfig = (): Config => {
Expand All @@ -17,6 +18,7 @@ const envConfig = (): Config => {
rpcUrl: requiredEnv('REACT_APP_RPC_URL'),
contract: requiredEnv('REACT_APP_CONTRACT'),
faucetUrl: process.env.REACT_APP_FAUCET,
enableLocalWallet: requiredBoolean('REACT_APP_ENABLE_LOCAL_WALLET'),
};
};

Expand Down
8 changes: 5 additions & 3 deletions web/src/wallet/SelectWalletModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ export default (props: Props) => {
>
Use Keplr
</Button>
<Button variant="contained" onClick={() => setWalletType(WalletType.LocalWallet)}>
Local wallet
</Button>
{config.enableLocalWallet && (
<Button variant="contained" onClick={() => setWalletType(WalletType.LocalWallet)}>
Local wallet
</Button>
)}
</div>
)}
{walletType && (
Expand Down

0 comments on commit 9e7b3e3

Please sign in to comment.