Skip to content

Commit 7b535a7

Browse files
authored
Docs: suggest using opa-config.yaml as name for config file (#6966)
And update some references throughout the docs. Fixes #6959 Signed-off-by: Anders Eknert <[email protected]>
1 parent 8412289 commit 7b535a7

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

ast/policy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ func (pkg *Package) MarshalJSON() ([]byte, error) {
570570
}
571571

572572
// IsValidImportPath returns an error indicating if the import path is invalid.
573-
// If the import path is invalid, err is nil.
573+
// If the import path is valid, err is nil.
574574
func IsValidImportPath(v Value) (err error) {
575575
switch v := v.(type) {
576576
case Var:

docs/content/configuration.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ required must be specified if the parent is defined. For example, when the
99
configuration contains a `status` key, the `status.service` field must be
1010
defined.
1111

12+
{{< info >}}
13+
OPA accepts any name for the configuration file. Some tooling may however benefit from knowing what name to associate
14+
with OPA's configuration file (for auto-completion of attributes, linting, etc.). The following names could be
15+
considered idiomatic for that purpose:
16+
- `opa-config.yaml` (or `.json`)
17+
- `opa-conf.yaml` (or `.json`)
18+
{{< /info >}}
19+
1220
The configuration file path is specified with the `-c` or `--config-file`
1321
command line argument:
1422

1523
```bash
16-
opa run -s -c config.yaml
24+
opa run -s -c opa-config.yaml
1725
```
1826

1927
The file can be either JSON or YAML format. The following is an example
@@ -1019,7 +1027,7 @@ It will read the contents of the file and set the config value with the token.
10191027
If using arrays/lists in the configuration the `--set` and `--set-file` overrides will not be able to
10201028
patch sub-objects of the list. They will overwrite the entire index with the new object.
10211029

1022-
For example, a `config.yaml` file with contents:
1030+
For example, a `opa-config.yaml` file with contents:
10231031

10241032
```yaml
10251033
services:
@@ -1034,7 +1042,7 @@ Used with overrides:
10341042

10351043
```shell
10361044
opa run \
1037-
--config-file config.yaml
1045+
--config-file opa-config.yaml
10381046
--set-file "services[0].credentials.bearer.token=/var/run/secrets/bearer_token.txt"
10391047
```
10401048

docs/content/docker-authorization.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,21 @@ decision_logs:
9797
console: true
9898
```
9999
100-
Save the above file as `config.yaml`. We'll need to place this somewhere where the plugin can find it.
100+
Save the above file as `opa-config.yaml`. We'll need to place this somewhere where the plugin can find it.
101101
The `/etc/docker` directory will be mounted as `/opa` in the container running the plugin, so let's create a
102102
sub-directory for our configuration file there.
103103

104104
```shell
105105
sudo mkdir -p /etc/docker/config
106-
sudo mv config.yaml /etc/docker/config/
106+
sudo mv opa-config.yaml /etc/docker/config/
107107
```
108108

109109
### 3. Install the opa-docker-authz plugin.
110110

111111
Install the `opa-docker-authz` plugin and point it to the config file just created.
112112

113113
```shell
114-
docker plugin install openpolicyagent/opa-docker-authz-v2:0.9 opa-args="-config-file /opa/config/config.yaml"
114+
docker plugin install openpolicyagent/opa-docker-authz-v2:0.9 opa-args="-config-file /opa/config/opa-config.yaml"
115115
```
116116

117117
You need to configure the Docker daemon to use the plugin for authorization.

docs/content/extensions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ go build -o opa++
332332

333333
Define an OPA configuration file that will use your plugin:
334334

335-
**config.yaml**:
335+
**opa-config.yaml**:
336336

337337
```yaml
338338
decision_logs:
@@ -345,7 +345,7 @@ plugins:
345345
Start OPA with the configuration file:
346346
347347
```bash
348-
./opa++ run --server --config-file config.yaml
348+
./opa++ run --server --config-file opa-config.yaml
349349
```
350350

351351
Exercise the plugin via the OPA API:

docs/content/management-discovery.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ with `region: "US"`, then the `bundle_name` will be `example/test1/p`.
201201

202202
Start an OPA with a boot configuration as shown below:
203203

204-
**config.yaml**
204+
**opa-config.yaml**
205205

206206
```yaml
207207
services:
@@ -220,7 +220,7 @@ labels:
220220
Run OPA:
221221
222222
```bash
223-
opa run -s -c config.yaml
223+
opa run -s -c opa-config.yaml
224224
```
225225

226226
You should see a log like below, which shows the bundle being downloaded. In
@@ -233,7 +233,7 @@ INFO Bundle downloaded and activated successfully. name=example/test1/p plugin=b
233233
Now start another OPA with a boot configuration as shown below. Notice the
234234
`region` is `UK`:
235235

236-
**config.yaml**
236+
**opa-config.yaml**
237237

238238
```yaml
239239
services:
@@ -252,7 +252,7 @@ labels:
252252
Run OPA:
253253
254254
```bash
255-
opa run -s -c config.yaml
255+
opa run -s -c opa-config.yaml
256256
```
257257

258258
In this case, the bundle being downloaded is `example/test2/p` as `region` is

0 commit comments

Comments
 (0)