Skip to content

Commit

Permalink
Fix shelley_testnet_v2 network identification
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaglumac committed Jul 4, 2020
1 parent 8da2159 commit dda54aa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"nix:flight": "NETWORK=mainnet nix-shell --argstr nodeImplementation cardano --argstr cluster mainnet_flight",
"nix:selfnode": "NETWORK=selfnode nix-shell --argstr nodeImplementation cardano --argstr cluster selfnode",
"nix:shelley_local": "NETWORK=shelley_testnet nix-shell --arg configOverride state-cluster/config.json --arg genesisOverride state-cluster/keys/genesis.json --argstr nodeImplementation cardano --argstr cluster local --arg useLocalNode true",
"nix:shelley_testnet": "NETWORK=shelley_testnet nix-shell --argstr nodeImplementation cardano --argstr cluster shelley_testnet",
"nix:shelley_testnet": "NETWORK=shelley_testnet_v2 nix-shell --argstr nodeImplementation cardano --argstr cluster shelley_testnet_v2",
"nix:shelley_qa": "NETWORK=shelley_qa nix-shell --argstr nodeImplementation cardano --argstr cluster shelley_qa",
"nix:staging": "NETWORK=staging nix-shell --argstr nodeImplementation cardano --argstr cluster staging",
"nix:testnet": "NETWORK=testnet nix-shell --argstr nodeImplementation cardano --argstr cluster testnet",
Expand Down
1 change: 1 addition & 0 deletions source/common/types/environment.types.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const STAGING = 'staging';
export const TESTNET = 'testnet';
export const SHELLEY_LOCAL = 'local';
export const SHELLEY_TESTNET = 'shelley_testnet';
export const SHELLEY_TESTNET_V2 = 'shelley_testnet_v2';
export const SHELLEY_QA = 'shelley_qa';

// jormungandr networks
Expand Down
5 changes: 5 additions & 0 deletions source/common/utils/environmentCheckers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
MAINNET,
MAINNET_FLIGHT,
PRODUCTION,
SHELLEY_TESTNET,
SHELLEY_TESTNET_V2,
SELFNODE,
STAGING,
TEST,
Expand All @@ -31,6 +33,9 @@ export const evaluateNetwork = (network: ?string) => {
if (network === MAINNET_FLIGHT) {
currentNetwork = MAINNET;
}
if (network === SHELLEY_TESTNET_V2) {
currentNetwork = SHELLEY_TESTNET;
}
return currentNetwork;
};

Expand Down
7 changes: 6 additions & 1 deletion source/main/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
OS_NAMES,
MAINNET,
MAINNET_FLIGHT,
SHELLEY_TESTNET,
SHELLEY_TESTNET_V2,
} from '../common/types/environment.types';
import {
evaluateNetwork,
Expand All @@ -34,8 +36,11 @@ import {

// environment variables
const CURRENT_NODE_ENV = process.env.NODE_ENV || DEVELOPMENT;
const RAW_NETWORK =
let RAW_NETWORK =
process.env.NETWORK === MAINNET_FLIGHT ? MAINNET : process.env.NETWORK || '';
if (process.env.NETWORK === SHELLEY_TESTNET_V2) {
RAW_NETWORK = SHELLEY_TESTNET;
}
const NETWORK = evaluateNetwork(process.env.NETWORK);
const isDev = checkIsDev(CURRENT_NODE_ENV);
const isTest = checkIsTest(CURRENT_NODE_ENV);
Expand Down

0 comments on commit dda54aa

Please sign in to comment.