Skip to content

Commit f5b6235

Browse files
Merge pull request #795 from laviniat1996/add_env
Add `.env` file
2 parents 737a94e + 129a616 commit f5b6235

File tree

155 files changed

+796
-622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+796
-622
lines changed

.env

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# public Avalanche API
2+
IP = "api.avax.network"
3+
PORT = 443
4+
PROTOCOL = "https"
5+
NETWORK_ID = 1
6+
7+
# localhost
8+
LOCAL_IP= "127.0.0.1"
9+
LOCAL_PORT = 9650
10+
LOCAL_PROTOCOL = "http"
11+
LOCAL_NETWORK_ID = 1337
12+
13+
# index API
14+
IP_INDEXER = "indexer-demo.avax.network"
15+
16+
# socket
17+
PROTOCOL_WS = "ws"
18+
HOST = "localhost"

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ docsHTML/
7676
# Yarn Integrity file
7777
.yarn-integrity
7878

79-
# dotenv environment variables file
80-
.env
81-
.env.test
82-
8379
# parcel-bundler cache (https://parceljs.org/)
8480
.cache
8581

examples/admin/alias.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import "dotenv/config"
12
import { Avalanche } from "../../src"
23
import { AdminAPI } from "../../src/apis/admin"
34

4-
const ip: string = "localhost"
5-
const port: number = 9650
6-
const protocol: string = "http"
7-
const networkID: number = 1337
5+
const ip = process.env.LOCAL_IP
6+
const port = Number(process.env.LOCAL_PORT)
7+
const protocol = process.env.LOCAL_PROTOCOL
8+
const networkID = Number(process.env.LOCAL_NETWORK_ID)
89
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
910
const admin: AdminAPI = avalanche.Admin()
1011

examples/admin/aliasChain.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import "dotenv/config"
12
import { Avalanche } from "../../src"
23
import { AdminAPI } from "../../src/apis/admin"
34

4-
const ip: string = "localhost"
5-
const port: number = 9650
6-
const protocol: string = "http"
7-
const networkID: number = 1337
5+
const ip = process.env.LOCAL_IP
6+
const port = Number(process.env.LOCAL_PORT)
7+
const protocol = process.env.LOCAL_PROTOCOL
8+
const networkID = Number(process.env.LOCAL_NETWORK_ID)
89
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
910
const admin: AdminAPI = avalanche.Admin()
1011

examples/admin/getChainAliases.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import "dotenv/config"
12
import { Avalanche } from "../../src"
23
import { AdminAPI } from "../../src/apis/admin"
34
import { Defaults } from "../../src/utils"
45

5-
const ip: string = "localhost"
6-
const port: number = 9650
7-
const protocol: string = "http"
8-
const networkID: number = 1337
6+
const ip = process.env.LOCAL_IP
7+
const port = Number(process.env.LOCAL_PORT)
8+
const protocol = process.env.LOCAL_PROTOCOL
9+
const networkID = Number(process.env.LOCAL_NETWORK_ID)
910
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
1011
const admin: AdminAPI = avalanche.Admin()
1112

examples/admin/getLoggerLevel.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import "dotenv/config"
12
import { Avalanche } from "../../src"
23
import { AdminAPI } from "../../src/apis/admin"
34
import { GetLoggerLevelResponse } from "../../src/apis/admin/interfaces"
45

5-
const ip: string = "localhost"
6-
const port: number = 9650
7-
const protocol: string = "http"
8-
const networkID: number = 1337
6+
const ip = process.env.LOCAL_IP
7+
const port = Number(process.env.LOCAL_PORT)
8+
const protocol = process.env.LOCAL_PROTOCOL
9+
const networkID = Number(process.env.LOCAL_NETWORK_ID)
910
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
1011
const admin: AdminAPI = avalanche.Admin()
1112

examples/admin/loadVMs.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import "dotenv/config"
12
import { Avalanche } from "../../src"
23
import { AdminAPI } from "../../src/apis/admin"
34
import { LoadVMsResponse } from "../../src/apis/admin/interfaces"
45

5-
const ip: string = "localhost"
6-
const port: number = 9650
7-
const protocol: string = "http"
8-
const networkID: number = 1337
6+
const ip = process.env.LOCAL_IP
7+
const port = Number(process.env.LOCAL_PORT)
8+
const protocol = process.env.LOCAL_PROTOCOL
9+
const networkID = Number(process.env.LOCAL_NETWORK_ID)
910
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
1011
const admin: AdminAPI = avalanche.Admin()
1112

examples/admin/lockProfile.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import "dotenv/config"
12
import { Avalanche } from "../../src"
23
import { AdminAPI } from "../../src/apis/admin"
34

4-
const ip: string = "localhost"
5-
const port: number = 9650
6-
const protocol: string = "http"
7-
const networkID: number = 1337
5+
const ip = process.env.LOCAL_IP
6+
const port = Number(process.env.LOCAL_PORT)
7+
const protocol = process.env.LOCAL_PROTOCOL
8+
const networkID = Number(process.env.LOCAL_NETWORK_ID)
89
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
910
const admin: AdminAPI = avalanche.Admin()
1011

examples/admin/memoryProfile.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import "dotenv/config"
12
import { Avalanche } from "../../src"
23
import { AdminAPI } from "../../src/apis/admin"
34

4-
const ip: string = "localhost"
5-
const port: number = 9650
6-
const protocol: string = "http"
7-
const networkID: number = 1337
5+
const ip = process.env.LOCAL_IP
6+
const port = Number(process.env.LOCAL_PORT)
7+
const protocol = process.env.LOCAL_PROTOCOL
8+
const networkID = Number(process.env.LOCAL_NETWORK_ID)
89
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
910
const admin: AdminAPI = avalanche.Admin()
1011

examples/admin/setLoggerLevel.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import "dotenv/config"
12
import { Avalanche } from "../../src"
23
import { AdminAPI } from "../../src/apis/admin"
34
import { SetLoggerLevelResponse } from "../../src/apis/admin/interfaces"
45

5-
const ip: string = "localhost"
6-
const port: number = 9650
7-
const protocol: string = "http"
8-
const networkID: number = 1337
6+
const ip = process.env.LOCAL_IP
7+
const port = Number(process.env.LOCAL_PORT)
8+
const protocol = process.env.LOCAL_PROTOCOL
9+
const networkID = Number(process.env.LOCAL_NETWORK_ID)
910
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
1011
const admin: AdminAPI = avalanche.Admin()
1112

0 commit comments

Comments
 (0)