Skip to content

Commit 4f41b3e

Browse files
committed
docs(router): added documentation for env vars
1 parent b28881e commit 4f41b3e

File tree

7 files changed

+62
-0
lines changed

7 files changed

+62
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export default {
22
index: 'Overview',
3+
'environment-variables': 'Environment Variables',
34
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: 'Environment Variables'
3+
---
4+
5+
# Environment Variables
6+
7+
## Available Environment Variables
8+
9+
The following environment variables are accepted by the router, and they override other configurations that can be set in the router's configuration file (`router.config.yaml`):
10+
11+
| Name | Accepted Values | Overrides (YAML) |
12+
|--------------------------|------------------------------------------------------|----------------------------------------------------------------|
13+
| `LOG_LEVEL` | `trace` / `debug` / `info` / `warn` / `error` | [`log.level`](./log#level) |
14+
| `LOG_FORMAT` | `json` / `pretty-tree` / `pretty-compact` | [`log.format`](./log#format) |
15+
| `LOG_FILTER` | `string` | [`log.filter`](./log#filter) |
16+
| `GRAPHIQL_ENABLED` | `true` / `false` | [`graphiql.enabled`](./graphiql#enabled) |
17+
| `PORT` | `number` (port number) | [`http.port`](./http#port) |
18+
| `HOST` | `string` (host name or IP address) | [`http.host`](./http#host) |
19+
| `SUPERGRAPH_FILE_PATH` | `string` (relative or absolute path to a local file) | [`supergraph[file].path`](./supergraph#path) |
20+
| `HIVE_CDN_ENDPOINT` | `string` (full url to Hive CDN supergraph artifact) | [`supergraph[hive].endpoint`](./supergraph#endpoint) |
21+
| `HIVE_CDN_KEY` | `string` (Hive CDN key) | [`supergraph[hive].key`](./supergraph#key) |
22+
| `HIVE_CDN_POLL_INTERVAL` | `string` (human-readable, for example: `10s`) | [`supergraph[hive].poll_interval`](./supergraph#poll_interval) |
23+
24+
> In cases where a configuration file (`router.config.yaml`) is used with environment variables at the same time, environment variables will only override the specific configuration values.
25+
26+
## Additional Variables
27+
28+
In addition, you may specify the following environment variables:
29+
30+
31+
| Name | Accepted Values | Description |
32+
|----------------------------|--------------------------------------------------------|----------------------------------------------------------------|
33+
| `ROUTER_CONFIG_FILE_PATH` | `string` (relative or absolute path to a local file) | Overrides the path to the router configuration file. |
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: 'graphiql'
3+
---
4+
5+
# graphiql
6+
7+
The `graphiql` configuration object allows you to control the GraphiQL interface.
8+
9+
## Options
10+
11+
### `enabled`
12+
13+
- **Type:** `boolean`
14+
- **Default:** `true`
15+
- **Environment Variable:** `GRAPHIQL_ENABLED`
16+
17+
The `enabled` property controls whether the GraphiQL interface is enabled or disabled.

packages/web/docs/src/content/router/configuration/http.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Router listens on for incoming GraphQL requests.
1313

1414
- **Type:** `string`
1515
- **Default:** `"0.0.0.0"`
16+
- **Environment Variable:** `HOST`
1617

1718
The `host` property specifies the IP address to which the router's HTTP server will bind.
1819

@@ -25,6 +26,7 @@ The `host` property specifies the IP address to which the router's HTTP server w
2526

2627
- **Type:** `integer`
2728
- **Default:** `4000`
29+
- **Environment Variable:** `PORT`
2830

2931
The `port` property specifies the network port that the router will listen on. Ensure this port is
3032
not already in use by another service on the same host. When running in a container, this is the

packages/web/docs/src/content/router/configuration/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ title: 'Configuration reference'
77
You can configure Hive Router using a YAML, JSON, or TOML file (by default, `router.config.yaml`).
88
We'll use YAML for all examples in this documentation since it's the most readable.
99

10+
Some configuration variables can be overridden at runtime using [environment variables](./environment-variables).
11+
1012
This page covers all the main configuration options available. Each option links to a detailed page
1113
that explains how to use that feature.
1214

packages/web/docs/src/content/router/configuration/log.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ You can control the verbosity, format, and filtering of the logs generated by th
1616

1717
- **Type:** `string`
1818
- **Default:** `info`
19+
- **Environment Variable:** `LOG_LEVEL`
1920

2021
The `level` property controls the verbosity of the logs. By default, the router is configured to be
2122
mostly silent at the `info` level, emitting only important operational messages, warnings, and
@@ -33,6 +34,7 @@ The available log levels, from most verbose to least, are:
3334

3435
- **Type:** `string`
3536
- **Default:** `json`
37+
- **Environment Variable:** `LOG_FORMAT`
3638

3739
The `format` property determines the structure of the log output.
3840

@@ -47,6 +49,7 @@ The `format` property determines the structure of the log output.
4749
### `filter`
4850

4951
- **Type:** `string`
52+
- **Environment Variable:** `LOG_FILTER`
5053

5154
The `filter` property provides advanced, fine-grained control over which log messages are emitted
5255
based on their origin (e.g., a specific module within the router) and their level. This can be used

packages/web/docs/src/content/router/configuration/supergraph.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Load the Supergraph schema from [Hive Console](../../schema-registry) CDN.
2424

2525
- **Type:** `string`
2626
- **Required:** Yes
27+
- **Environment Variable:** `HIVE_CDN_ENDPOINT`
2728

2829
The [_Hive CDN Endpoint_](../../schema-registry/get-started/apollo-federation#cdn-access) of your
2930
target.
@@ -39,6 +40,7 @@ supergraph:
3940

4041
- **Type:** `string`
4142
- **Required:** Yes
43+
- **Environment Variable:** `HIVE_CDN_KEY`
4244

4345
The [_Hive CDN key/token_](../../schema-registry/management/targets#creating-a-cdn-access-token) of
4446
your target.
@@ -55,6 +57,7 @@ supergraph:
5557
- **Type:** `string`
5658
- **Required:** No
5759
- **Default:** `10s`
60+
- **Environment Variable:** `HIVE_CDN_POLL_INTERVAL`
5861

5962
A human-readable string representing the interval at which the router should poll Hive CDN for
6063
changes.
@@ -114,6 +117,7 @@ Load the schema from a local file.
114117

115118
- **Type:** `string`
116119
- **Required:** Yes
120+
- **Environment Variable:** `SUPERGRAPH_FILE_PATH`
117121

118122
Path to your supergraph schema file. Can be absolute or relative to where you're running the router.
119123

0 commit comments

Comments
 (0)