Skip to content

Commit

Permalink
Use env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
InversionSpaces committed Oct 20, 2023
1 parent 30ca4bd commit 2a4a619
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 15 deletions.
209 changes: 209 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"license": "Apache-2.0",
"type": "module",
"devDependencies": {
"@multiformats/multiaddr": "^12.1.7",
"@tsconfig/node18-strictest-esm": "^1.0.1",
"@types/jest": "^29.5.5",
"jest": "^29.7.0",
Expand Down
1 change: 1 addition & 0 deletions test/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const CONFIG_PATH = "./gateway/configs/quickstart_config.json";
*/
export interface GatewayConfig {
providers: string[];
relay: string;
port: number;
mode: string;
}
Expand Down
18 changes: 10 additions & 8 deletions test/consts.ts → test/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
* limitations under the License.
*/

export const CHAIN_PRIVATE_KEY =
"0x3cc23e0227bd17ea5d6ea9d42b5eaa53ad41b1974de4755c79fe236d361a6fd5";
function getOrFail(envVar: string): string {
const value = process.env[envVar];
if (value === undefined) {
throw new Error(`${envVar} is not set`);
}

export const LOCAL_PEER_IDS = [
"12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR",
"12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK",
"12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ",
];
return value;
}

export const FLUENCE_ENV = "local";
export const FLUENCE_ENV = getOrFail("FLUENCE_ENV");
export const FLUENCE_CHAIN_PRIVATE_KEY = getOrFail("FLUENCE_CHAIN_PRIVATE_KEY");
export const RPC_PROVIDERS = getOrFail("RPC_PROVIDERS").split(",");
Loading

0 comments on commit 2a4a619

Please sign in to comment.