Skip to content

Commit c7cda9a

Browse files
committed
fix: correction add env variable for torus network
1 parent a4cf0be commit c7cda9a

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/backend/utilities/config.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// eslint-disable-next-line import/named
2-
import { SubVerifierDetails } from '@toruslabs/customauth'
2+
import { SubVerifierDetails, TORUS_NETWORK_TYPE } from '@toruslabs/customauth'
33
import { ILocalNetNearConfig, INearConfig } from '../near'
44

55
const defaultBootstraps = [
@@ -16,7 +16,12 @@ export const sufficientFunds = process.env.SUFFICIENT_ACCOUNT_FUNDS || `81800000
1616
// Time-sensitive signatures are valid for 5 minutes
1717
export const sigValidity = 5 * 60000
1818
export const bootstrapNodes = process.env.BOOTSTRAP_NODES ? JSON.parse(process.env.BOOTSTRAP_NODES) : defaultBootstraps
19-
export const torusNetwork = process.env.TORUS_NETWORK || `testnet`
19+
20+
const parsedTorusNetwork = process.env.TORUS_NETWORK
21+
if (parsedTorusNetwork && parsedTorusNetwork !== `mainnet` && parsedTorusNetwork !== `testnet`) {
22+
throw new Error(`Unexpected Torus Network!`)
23+
}
24+
export const torusNetwork: TORUS_NETWORK_TYPE = (parsedTorusNetwork as `mainnet` | `testnet` | undefined) || `testnet`
2025

2126
const nearNetwork = process.env.NEAR_NETWORK || `testnet`
2227

src/components/register/RegisterMethods.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import NearIcon from '@/components/icons/brands/Near.vue'
6565
import DiscordIcon from '@/components/icons/Discord.vue'
6666
import InfoIcon from '@/components/icons/Info.vue'
6767
68-
import { torusVerifiers, TorusVerifiers } from '@/backend/utilities/config'
68+
import { domain, torusNetwork, torusVerifiers, TorusVerifiers } from '@/backend/utilities/config'
6969
import { getAccountIdFromPrivateKey, IWalletStatus } from '@/backend/auth'
7070
import { walletLogin, generateAndSetKey } from '@/backend/near'
7171
@@ -86,8 +86,8 @@ export default Vue.extend({
8686
data(): IData {
8787
return {
8888
torus: new DirectWebSdk({
89-
baseUrl: `${process.env.DOMAIN}/oauth`,
90-
network: `testnet`, // details for test net
89+
baseUrl: `${domain}/oauth`,
90+
network: torusNetwork, // details for test net
9191
}),
9292
isLoading: false,
9393
dark: false,

0 commit comments

Comments
 (0)