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
+32-7Lines changed: 32 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,15 +107,40 @@ Each JSON configuration file for the gateways can specify detailed settings for
107
107
```
108
108
109
109
## Authentication
110
-
Authentication can be enabled using the `--auth` flag. The auth token should be set through environment variables `GATEWAY_PASSWORD`.
111
110
112
-
Auth token needs to be the last entry in the RPC gateway URL. Example:
111
+
Authentication can be enabled using the `--auth` flag. The authentication system uses a token-based approach with rate limiting.
113
112
114
-
`https://sample/rpc-gateway/sepolia/a1b2c3d4e5f7`
113
+
### Token Configuration
115
114
116
-
### Running the Application
117
-
To run the application with authentication:
115
+
The token configuration should be provided through the `GATEWAY_TOKEN_MAP` environment variable. This variable should contain a JSON string representing a map of tokens to their corresponding information. Each token entry includes a name and the number of requests allowed per second.
DEBUG=true GATEWAY_PASSWORD=my_auth_token go run . --config config.json --auth
121
-
```
125
+
126
+
### URL Format
127
+
128
+
When authentication is enabled, the auth token needs to be the last entry in the RPC gateway URL.
129
+
130
+
Example:
131
+
132
+
`https://sample/rpc-gateway/sepolia/token1`
133
+
134
+
In this example, `token1` is the authentication token that must match one of the tokens defined in the `GATEWAY_TOKEN_MAP`.
135
+
136
+
### Rate Limiting
137
+
138
+
Each token has its own rate limit, defined by the `numOfRequestPerSec` value in the token configuration. If a client exceeds this limit, they will receive a 429 (Too Many Requests) status code.
0 commit comments