github.com/avenga/couper@v1.12.2/docs/website/content/2.configuration/1.configuration-file.md (about) 1 --- 2 title: 'Configuration File' 3 description: 'Overview how to configure Couper with its configuration file.' 4 --- 5 6 # Configuration File 7 8 The language for Couper's configuration file is [HCL 2.0](https://github.com/hashicorp/hcl/tree/hcl2#information-model-and-syntax), a configuration language by HashiCorp. 9 10 ## IDE Extension 11 12 Couper provides its own IDE extension that adds Couper-specific highlighting and autocompletion to Couper's configuration file `couper.hcl` in Visual Studio Code. 13 14 Get it from the [Visual Studio Market Place](https://marketplace.visualstudio.com/items?itemName=couper.couperconf) or visit the [Extension repository](https://github.com/avenga/couper-vscode). 15 16 ## File Name 17 18 The file-ending of your configuration file should be `.hcl` to have syntax highlighting within your IDE. 19 20 The file name defaults to `couper.hcl` in your working directory. This can be changed with the `-f` command-line flag. With `-f /opt/couper/my_conf.hcl` couper changes the working directory to `/opt/couper` and loads `my_conf.hcl`. 21 22 ## Basic File Structure 23 24 Couper's configuration file consists of nested configuration blocks that configure 25 the gateway. There are a large number of options, but let's focus on the main structure first: 26 27 ```hcl 28 server "my_project" { 29 files { 30 # ... 31 } 32 33 spa { 34 # ... 35 } 36 37 api { 38 access_control = ["foo"] 39 endpoint "/bar" { 40 proxy { 41 backend { } 42 } 43 request "sub-request" { 44 backend { } 45 } 46 response { } 47 } 48 } 49 } 50 51 definitions { 52 # ... 53 } 54 55 settings { 56 # ... 57 } 58 59 defaults { 60 # ... 61 } 62 ``` 63 64 - `server` main configuration block(s). 65 - `files` configuration block for file serving. 66 - `spa` configuration block for Web serving (SPA assets). 67 - `api` configuration block(s) that bundle(s) endpoints under a certain base path or `access_control` list. 68 - `access_control` attribute that sets access control for a block context. 69 - `endpoint` configuration block for Couper's entry points. 70 - `proxy` configuration block for a proxy request and response to an origin. 71 - `backend` configuration block for connection to local/remote backend service(s). 72 - `request` configuration block for a manual request to an origin. 73 - `backend` configuration block for connection to local/remote backend service(s). 74 - `response` configuration block for a manual client response. 75 - `definitions` block for predefined configurations, that can be referenced. 76 - `settings` block for server configuration which applies to the running instance. 77 - `defaults` block for default/fallback values.