|
| 1 | +# Configuration |
| 2 | + |
| 3 | +## Configuration file |
| 4 | + |
| 5 | +The Data Aggregation API can be configured with flags, environments variables and configuration file. |
| 6 | + |
| 7 | +The precedence order for the different methods is: |
| 8 | + |
| 9 | +!!! info |
| 10 | + |
| 11 | + * flags |
| 12 | + * environment variables |
| 13 | + * configuration file (settings.yml) |
| 14 | + |
| 15 | +```yaml |
| 16 | +Datacenter: "europe" |
| 17 | + |
| 18 | +Log: |
| 19 | + Level: "error" |
| 20 | + Pretty: true |
| 21 | + |
| 22 | +API: |
| 23 | + ListenAddress: "127.0.0.1" |
| 24 | + ListenPort: 1234 |
| 25 | + |
| 26 | +Authentication: |
| 27 | + LDAP: |
| 28 | + URL: "ldaps://URL.local" |
| 29 | + BindDN: "cn=<user>,OU=<ou>,DC=<local>" |
| 30 | + BaseDN: "DC=<local>" |
| 31 | + Password: "<some_password>" |
| 32 | + WorkersCount: 10 |
| 33 | + Timeout: 5s |
| 34 | + MaxConnectionLifetime: 1m |
| 35 | + InsecureSkipVerify: false |
| 36 | + |
| 37 | +NetBox: |
| 38 | + URL: "https://netbox.local" |
| 39 | + APIKey: "<some_key>" |
| 40 | + DatacenterFilterKey: "site" |
| 41 | + LimitPerPage: 500 |
| 42 | + |
| 43 | +Build: |
| 44 | + Interval: "30m" |
| 45 | + AllDevicesMustBuild: false |
| 46 | +``` |
| 47 | +
|
| 48 | +## Global settings |
| 49 | +
|
| 50 | +| Parameter | Default | Description | |
| 51 | +|-----------|---------|-------------| |
| 52 | +| Datacenter | `` | Value used to filter devices. The key is defined by `DatacenterFilterKey`. | |
| 53 | + |
| 54 | +## Log settings |
| 55 | + |
| 56 | +All parameters below are in the `Log` section of the configuration. |
| 57 | +This section is optional. |
| 58 | + |
| 59 | +| Parameter | Default | Description | |
| 60 | +|-----------|---------|-------------| |
| 61 | +| Level | `info` | Log level. | |
| 62 | +| Pretty | `false` | If enabled: human readable logs (with colors). If disabled: structured logs. | |
| 63 | + |
| 64 | +## API settings |
| 65 | + |
| 66 | +All parameters below are in the `API` section of the configuration. |
| 67 | +This section is optional. |
| 68 | + |
| 69 | +| Parameter | Default | Description | |
| 70 | +|-----------|---------|-------------| |
| 71 | +| ListenAddress | `0.0.0.0` | Listening address of the web API. | |
| 72 | +| ListenPort | `8080` | Listening port of the web API. | |
| 73 | + |
| 74 | +## Authentication settings |
| 75 | + |
| 76 | +All parameters below are in the `Authentication`->`LDAP` section of the configuration. |
| 77 | + |
| 78 | +LDAP Authentication is only to authenticate users when they try to query the Web API, i.e. when they want to retrieve the built config. |
| 79 | + |
| 80 | +This section is optional. |
| 81 | + |
| 82 | +| Parameter | Default | Description | |
| 83 | +|-----------|---------|-------------| |
| 84 | +| InsecureSkipVerify | `false` | Ignore LDAP TLS warnings. | |
| 85 | +| URL | | URL of the LDAP server. | |
| 86 | +| BindDN | | Bind used to query the LDAP server. | |
| 87 | +| Password | | Password to query the LDAP server. | |
| 88 | +| BaseDN | | Only users matching the BaseDN are authorized to query the web API. | |
| 89 | +| WorkersCount | `10` | Number of workers to authenticate users concurrently. | |
| 90 | +| Timeout | `10s` | Time to wait before considering a LDAP request timed out. | |
| 91 | +| MaxConnectionLifetime | `1m` | Lifetime of worker connection to LDAP. Useful to re-use existing LDAP connection. | |
| 92 | + |
| 93 | + |
| 94 | +## NetBox settings |
| 95 | + |
| 96 | +All parameters below are in the `NetBox` section of the configuration. |
| 97 | + |
| 98 | +| Parameter | Default | Description | |
| 99 | +|-----------|---------|-------------| |
| 100 | +| URL | | NetBox base URL. | |
| 101 | +| APIKey | | NetBox API token. | |
| 102 | +| DatacenterFilterKey | `site` | Key used to filter devices, using `Datacenter` as a value. | |
| 103 | +| LimitPerPage | `100` | Number of elements per page when getting data from NetBox API. | |
| 104 | + |
| 105 | +## Build settings |
| 106 | + |
| 107 | +All parameters below are in the `NetBox` section of the configuration. |
| 108 | +This section is optional. |
| 109 | + |
| 110 | +| Parameter | Default | Description | |
| 111 | +|-----------|---------|-------------| |
| 112 | +| Interval | `1m` | Build interval, e.g.: `10m`, `1h` | |
| 113 | +| AllDevicesMustBuild | `false` | The build fails if one device has not been built. | |
| 114 | + |
| 115 | +## Alternative methods |
| 116 | + |
| 117 | +### Environment variables |
| 118 | + |
| 119 | +All settings available in the configuration file can be set as environment variables, but: |
| 120 | + |
| 121 | +* all variables must be prefixed by `DAAPI_` |
| 122 | +* uppercase only |
| 123 | +* `_` is the level separator |
| 124 | + |
| 125 | +For example, the equivalent of this config file: |
| 126 | + |
| 127 | +``` yaml |
| 128 | +Datacenter: "europe" |
| 129 | +NetBox: |
| 130 | + URL: "https://netbox.local" |
| 131 | + APIKey: "<some_key>" |
| 132 | +``` |
| 133 | + |
| 134 | +is: |
| 135 | + |
| 136 | +```shell |
| 137 | +DAAPI_DATACENTER="europe" |
| 138 | +DAAPI_NETBOX_URL="https://netbox.local" |
| 139 | +DAAPI_NETBOX_APIKEY="<some_key>" |
| 140 | +``` |
0 commit comments