Skip to content

Commit b6ee33e

Browse files
committed
add documentation regarding the configuration
Signed-off-by: Augustin Husson <[email protected]>
1 parent e8f6986 commit b6ee33e

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The following Language Clients have been tested with this language server. More
6262

6363
Feel free to reach out if you want to use it with another Editor/Tool.
6464

65-
Reading this [documentation](./doc/developing_editor.md) can help you in your work
65+
Reading this [documentation](./doc/developing_editor.md) can help you in your work.
6666

6767
### VS Code
6868

doc/developing_editor.md

+21-6
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,33 @@ This documentation will give you some tips to help when you are going to support
66
## Config
77
There is two different config used by the promql-server.
88

9-
### YAML configuration (cold configuration)
10-
The first one is a classic yaml file which can be used to customize the server when it is starting. It has the following structure:
9+
### Cold configuration (YAML or by environment)
10+
The first one is a classic yaml file which can be used to customize the server when it is starting. It's specified by adding the `--config-file` command line flag when starting the language server.
11+
12+
It has the following structure:
1113

1214
```yaml
13-
activate_rpc_log: false # It's a boolean in order to activate or deactivate the rpc log. It's deactivated by default
15+
activate_rpc_log: false # It's a boolean in order to activate or deactivate the rpc log. It's deactivated by default and mainly useful for debugging the language server, by inspecting the communication with the language client.
1416
log_format: "text" # The format of the log printed. Possible value: json, text. Default value: "text"
1517
prometheus_url: "http://localhost:9090" # the HTTP URL of the prometheus server.
16-
rest_api_port: 8080 # When set, the server will be started as an HTTP server. Default value: 0
18+
rest_api_port: 8080 # When set, the server will be started as an HTTP server that provides a REST API instead of the language server protocol. Default value: 0
19+
```
20+
21+
In case the file is not provided, it will read the configuration from the environment variables with the following structure:
22+
23+
```bash
24+
export LANGSERVER_ACTIVATERPCLOG="true"
25+
export LANGSERVER_PROMETHEUSURL="http://localhost:9090"
26+
export LANGSERVER_RESTAPIPORT"="8080"
27+
export LANGSERVER_LOGFORMAT"="json"
1728
```
1829

30+
Note: documentation and default value are the same for both configuration (yaml and environment)
31+
1932
### JSON configuration (hot configuration)
20-
There is a second configuration which is used only at the runtime.
33+
There is a second configuration which is used only at the runtime and can be sent by the language client over the `DidChangeConfiguration` API. It's used to sync configuration from the text editor to the language server.
34+
35+
It has the following structure:
2136

2237
```json
2338
{
@@ -27,4 +42,4 @@ There is a second configuration which is used only at the runtime.
2742
}
2843
```
2944

30-
This configuration will be watched thanks to the method implemented `DidChangeConfiguration`
45+
Using this way of changing configuration requires both providing those config options in the Text editor and sending them to the language server whenever they are changed.

0 commit comments

Comments
 (0)