|
1 |
| -# indexer |
| 1 | +# indexer |
| 2 | + |
| 3 | +## Configuration |
| 4 | + |
| 5 | +You can configure the application in 3 ways. |
| 6 | +The order of priority is |
| 7 | +1. Command line arguments |
| 8 | +2. Environment variables |
| 9 | +3. Configuration files |
| 10 | + |
| 11 | +### Configuration using command line arguments |
| 12 | +You can configure the application using command line arguments. |
| 13 | +For example to configure the `rpc.url` configuration, you can use the `--rpc-url` command line argument. |
| 14 | +Only select arguments are implemented. More on this below. |
| 15 | + |
| 16 | +### Configuration using environment variables |
| 17 | +You can also configure the application using environment variables. You can configure any configuration in the `config.yml` file using environment variables by replacing the `.` in the configuration with `_` and making the variable name uppercase. |
| 18 | +For example to configure the `rpc.url` configuration to `https://my-rpc.com`, you can set the `RPC_URL` environment variable to `https://my-rpc.com`. |
| 19 | + |
| 20 | +### Configuration using configuration files |
| 21 | +The default configuration file is `configs/config.yml`. You can use the `--config` flag to specify a different configuration file. |
| 22 | +If you want to add secrets to the configuration file, you can copy `configs/secrets.example.yml` to `configs/secrets.yml` and add the secrets. They won't be commited to the repository or the built image. |
| 23 | + |
| 24 | +### Supported configurations: |
| 25 | + |
| 26 | +#### RPC URL |
| 27 | +URL to use as the RPC client. |
| 28 | + |
| 29 | +cmd: `--rpc-url` |
| 30 | +env: `RPC_URL` |
| 31 | +yaml: |
| 32 | +```yaml |
| 33 | +rpc: |
| 34 | + url: https://rpc.com |
| 35 | +``` |
| 36 | +
|
| 37 | +#### Log Level |
| 38 | +Log level for the logger. Default is `warn`. |
| 39 | + |
| 40 | +cmd: `--log-level` |
| 41 | +env: `LOG_LEVEL` |
| 42 | +yaml: |
| 43 | +```yaml |
| 44 | +log: |
| 45 | + level: debug |
| 46 | +``` |
| 47 | + |
| 48 | +#### Pretty log |
| 49 | +Whether to print logs in a pretty format. Affects performance. Default is `false`. |
| 50 | + |
| 51 | +env: `PRETTY_LOG` |
| 52 | +yaml: |
| 53 | +```yaml |
| 54 | +log: |
| 55 | + pretty: true |
| 56 | +``` |
| 57 | + |
| 58 | +#### Poller |
| 59 | +Whether to enable the poller. Default is `true`. |
| 60 | + |
| 61 | +cmd: `--poller` |
| 62 | +env: `POLLER_ENABLED` |
| 63 | +yaml: |
| 64 | +```yaml |
| 65 | +poller: |
| 66 | + enabled: true |
| 67 | +``` |
| 68 | + |
| 69 | +#### Poller Interval |
| 70 | +Poller trigger interval in millisecons. Default is `1000`. |
| 71 | + |
| 72 | +env: `POLLER_INTERVAL` |
| 73 | +yaml: |
| 74 | +```yaml |
| 75 | +poller: |
| 76 | + interval: 3000 |
| 77 | +``` |
| 78 | + |
| 79 | +#### Poller Batch Size |
| 80 | +How many blocks to poll each interval. Default is `10`. |
| 81 | + |
| 82 | +env: `POLLER_BATCH_SIZE` |
| 83 | +yaml: |
| 84 | +```yaml |
| 85 | +poller: |
| 86 | + batchSize: 3 |
| 87 | +``` |
| 88 | + |
| 89 | +#### Poller From Block |
| 90 | +From which block to start polling. Default is `0`. |
| 91 | + |
| 92 | +env: `POLLER_FROM_BLOCK` |
| 93 | +yaml: |
| 94 | +```yaml |
| 95 | +poller: |
| 96 | + fromBlock: 20000000 |
| 97 | +``` |
| 98 | + |
| 99 | +#### Poller Until Block |
| 100 | +Until which block to poll. If not set, it will poll until the latest block. |
| 101 | + |
| 102 | +env: `POLLER_UNTIL_BLOCK` |
| 103 | +yaml: |
| 104 | +```yaml |
| 105 | +poller: |
| 106 | + untilBlock: 20000010 |
| 107 | +``` |
| 108 | + |
| 109 | +#### Commiter |
| 110 | +Whether to enable the commiter. Default is `true`. |
| 111 | + |
| 112 | +cmd: `--commiter` |
| 113 | +env: `COMMITER_ENABLED` |
| 114 | +yaml: |
| 115 | +```yaml |
| 116 | +commiter: |
| 117 | + enabled: true |
| 118 | +``` |
| 119 | + |
| 120 | +#### Commiter Interval |
| 121 | +Commiter trigger interval in millisecons. Default is `250`. |
| 122 | + |
| 123 | +env: `COMMITER_INTERVAL` |
| 124 | +yaml: |
| 125 | +```yaml |
| 126 | +commiter: |
| 127 | + interval: 3000 |
| 128 | +``` |
| 129 | + |
| 130 | +#### Commiter Batch Size |
| 131 | +How many blocks to commit each interval. Default is `10`. |
| 132 | + |
| 133 | +env: `COMMITER_BATCH_SIZE` |
| 134 | +yaml: |
| 135 | +```yaml |
| 136 | +commiter: |
| 137 | + batchSize: 3 |
| 138 | +``` |
| 139 | + |
| 140 | +#### Failure Recoverer |
| 141 | +Whether to enable the failure recoverer. Default is `true`. |
| 142 | + |
| 143 | +cmd: `--failure-recoverer` |
| 144 | +env: `FAILURE_RECOVERER_ENABLED` |
| 145 | +yaml: |
| 146 | +```yaml |
| 147 | +failureRecoverer: |
| 148 | + enabled: true |
| 149 | +``` |
| 150 | + |
| 151 | +#### Failure Recoverer Interval |
| 152 | +Failure recoverer trigger interval in millisecons. Default is `1000`. |
| 153 | + |
| 154 | +env: `FAILURE_RECOVERER_INTERVAL` |
| 155 | +yaml: |
| 156 | +```yaml |
| 157 | +failureRecoverer: |
| 158 | + interval: 3000 |
| 159 | +``` |
| 160 | + |
| 161 | +#### Failure Recoverer Batch Size |
| 162 | +How many blocks to recover each interval. Default is `10`. |
| 163 | + |
| 164 | +env: `FAILURE_RECOVERER_BATCH_SIZE` |
| 165 | +yaml: |
| 166 | +```yaml |
| 167 | +failureRecoverer: |
| 168 | + batchSize: 3 |
| 169 | +``` |
| 170 | + |
| 171 | +#### Storage |
| 172 | +This application has 3 kinds of strorage. Main, Staging and Orchestrator. |
| 173 | +Each of them takes similar configuration depending on the driver you want to use. |
| 174 | + |
| 175 | +There are no defaults, so this needs to be configured. |
| 176 | + |
| 177 | +```yaml |
| 178 | +storage: |
| 179 | + main: |
| 180 | + driver: "clickhouse" |
| 181 | + clickhouse: |
| 182 | + host: "localhost" |
| 183 | + port: 3000 |
| 184 | + user: "admin" |
| 185 | + password: "admin" |
| 186 | + database: "base" |
| 187 | + staging: |
| 188 | + driver: "memory" |
| 189 | + memory: |
| 190 | + maxItems: 1000000 |
| 191 | + orchestrator: |
| 192 | + driver: "memory" |
| 193 | +``` |
0 commit comments