You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58-36Lines changed: 58 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,47 +39,69 @@ go test -v ./...
39
39
For local development and testing, you can run the application with:
40
40
41
41
```console
42
-
DEBUG=true go run . --config config.yml
42
+
DEBUG=true go run . --config config.json
43
43
```
44
44
45
-
## Configuration
45
+
Additionally, to load configuration from an environment variable, use the `--env` flag. Ensure the `GATEWAY_CONFIG` environment variable is set with the main configuration data.
46
46
47
-
A main YAML configuration (`config.yml`) specifies the metrics server port and multiple gateways, each with its own `.yml` configuration file:
47
+
```console
48
+
DEBUG=true go run . --env
49
+
```
48
50
49
-
```yaml
50
-
metrics:
51
-
port: 9090# Port for Prometheus metrics, served on /metrics and /
51
+
## Configuration
52
52
53
-
gateways:
54
-
- config-file: "config_holesky.yml"
55
-
name: "Holesky gateway"
56
-
- config-file: "config_sepolia.yml"
57
-
name: "Sepolia gateway"
53
+
The main configuration has been updated to use JSON format (`config.json`). It specifies the metrics server port and multiple gateways, each with its own JSON configuration file:
54
+
55
+
```json
56
+
{
57
+
"metrics": {
58
+
"port": 9090
59
+
},
60
+
"port": 4000,
61
+
"gateways": [
62
+
{
63
+
"configFile": "config_holesky.json",
64
+
"name": "Holesky gateway"
65
+
},
66
+
{
67
+
"configFile": "config_sepolia.json",
68
+
"name": "Sepolia gateway"
69
+
}
70
+
]
71
+
}
58
72
```
59
73
60
-
Each `.yml` configuration file for the gateways can specify detailed settings for proxy behavior, health checks, and target node providers. Here is an example of what these individual gateway configuration files can contain:
61
-
62
-
```yaml
63
-
proxy:
64
-
port: "3000" # Port for RPC gateway
65
-
upstreamTimeout: "1s" # When is a request considered timed out
66
-
67
-
healthChecks:
68
-
interval: "5s" # How often to perform health checks
69
-
timeout: "1s" # Timeout duration for health checks
70
-
failureThreshold: 2 # Failed checks until a target is marked unhealthy
71
-
successThreshold: 1 # Successes required to mark a target healthy again
72
-
73
-
targets: # Failover order is determined by the list order
74
-
- name: "Cloudflare"
75
-
connection:
76
-
http:
77
-
url: "https://cloudflare-eth.com"
78
-
- name: "Alchemy"
79
-
connection:
80
-
http:
81
-
url: "https://alchemy.com/rpc/<apikey>"
74
+
Each JSON configuration file for the gateways can specify detailed settings for proxy behavior, health checks, and target node providers. Here is an example of what these individual gateway configuration files might contain:
75
+
76
+
```json
77
+
{
78
+
"proxy": {
79
+
"port": "3000",
80
+
"upstreamTimeout": "1s"
81
+
},
82
+
"healthChecks": {
83
+
"interval": "5s",
84
+
"timeout": "1s",
85
+
"failureThreshold": 2,
86
+
"successThreshold": 1
87
+
},
88
+
"targets": [
89
+
{
90
+
"name": "Cloudflare",
91
+
"connection": {
92
+
"http": {
93
+
"url": "https://cloudflare-eth.com"
94
+
}
95
+
}
96
+
},
97
+
{
98
+
"name": "Alchemy",
99
+
"connection": {
100
+
"http": {
101
+
"url": "https://alchemy.com/rpc/<apikey>"
102
+
}
103
+
}
104
+
}
105
+
]
106
+
}
82
107
```
83
-
84
-
Any of these configuration files can be also loaded from URL if one is provided as path.
0 commit comments