Skip to content

Commit 7fc2831

Browse files
committed
issue #194 - missing parameters in configuration reference
1 parent 582f890 commit 7fc2831

File tree

2 files changed

+195
-23
lines changed

2 files changed

+195
-23
lines changed

config/db_tools.standalone.complete.sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ anonymization:
104104
anonymizer: anonymizer_name
105105
# ... anonymizer specific options...
106106
column2:
107-
# ...
107+
# ...
108108
table2:
109109
# ...
110110
connection_two:

docs/content/configuration/reference.md

Lines changed: 194 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,152 @@ relative to the configuration file directory the path is defined
2929
within.
3030
:::
3131

32-
## Index
33-
34-
[`anonymizer_paths`](#anonymizer-paths) |
35-
[`backup_binary`](#backup-binary) |
36-
[`backup_excluded_tables`](#backup-excluded-tables) |
37-
[`backup_expiration_age`](#backup-expiration-age) |
38-
[`backup_options`](#backup-options) |
39-
[`backup_timeout`](#backup-timeout) |
40-
[`connections` (standalone)](#connections) |
41-
[`default_connection`](#default-connection) |
42-
[`restore_binary`](#restore-binary) |
43-
[`restore_options`](#restore-options) |
44-
[`restore_timeout`](#restore-timeout) |
45-
[`storage_directory`](#storage-directory) |
46-
[`storage_filename_strategy`](#storage-filename-strategy) |
47-
[`workdir`](#workdir)
32+
<div class="toc-inline">
33+
34+
[[toc]]
35+
36+
</div>
37+
38+
<style module>
39+
.toc-inline .table-of-contents ul {
40+
list-style: none;
41+
display: flex;
42+
}
43+
.toc-inline .table-of-contents li {
44+
flex: 1;
45+
display: inline-block;
46+
}
47+
</style>
48+
49+
## `anonymization`
50+
51+
Write the anonymization configuration directly in the main configuration file.
52+
53+
Keys under the first dimension are connections names, then follows the structure
54+
expected in anonymization configuration files.
55+
56+
<div class="symfony">
57+
58+
```yaml
59+
# When you have a single connection, and a single file:
60+
db_tools:
61+
anonymization:
62+
connection_one:
63+
table1:
64+
column1:
65+
anonymizer: anonymizer_name
66+
# ... anonymizer specific options...
67+
column2:
68+
# ...
69+
table2:
70+
# ...
71+
connection_two:
72+
# ...
73+
```
74+
75+
:::tip
76+
Connection names are Doctrine bundle connection names. If you have a single
77+
one with Symfony default configuration, its name is `default`.
78+
:::
79+
80+
</div>
81+
<div class="standalone">
82+
83+
```yaml
84+
anonymization:
85+
connection_one:
86+
table1:
87+
column1:
88+
anonymizer: anonymizer_name
89+
# ... anonymizer specific options...
90+
column2:
91+
# ...
92+
table2:
93+
# ...
94+
connection_two:
95+
# ...
96+
```
97+
98+
:::tip
99+
Whenever you have a single unamed connection, its name will be `default`.
100+
:::
101+
102+
</div>
103+
104+
:::tip
105+
For more information about anonymization structure, refer to the [Anonymization section](../anonymization/essentials).
106+
:::
107+
108+
## `anonymization_files`
109+
110+
Files that contains anonymization configuration.
111+
112+
<div class="symfony">
113+
114+
```yaml
115+
# When you have a single connection, and a single file:
116+
db_tools:
117+
anonymization_files: '%kernel.project_dir%/config/anonymizations.yaml'
118+
119+
# Or with multiple connections:
120+
db_tools:
121+
anonymization_files:
122+
connection_one: '%kernel.project_dir%/config/anonymizations/connection_one.yaml'
123+
connection_two: '%kernel.project_dir%/config/anonymizations/connection_two.yaml'
124+
125+
# Each connection may have multiple files:
126+
db_tools:
127+
anonymization_files:
128+
connection_one:
129+
- '%kernel.project_dir%/config/anonymizations/connection_one_1.yaml'
130+
- '%kernel.project_dir%/config/anonymizations/connection_one_2.yaml'
131+
# ...
132+
```
133+
134+
:::tip
135+
Connection names are Doctrine bundle connection names. If you have a single
136+
one with Symfony default configuration, its name is `default`.
137+
:::
138+
139+
:::tip
140+
File paths must be absolute, use Symfony parameters to refer the project root.
141+
:::
142+
143+
</div>
144+
<div class="standalone">
145+
146+
```yaml
147+
# When you have a single connection, and a single file:
148+
anonymization_files: './anonymizations.yaml'
149+
150+
# Or with multiple connections:
151+
anonymization_files:
152+
connection_one: './anonymizations/connection_one.yaml'
153+
connection_two: './anonymizations/connection_two.yaml'
154+
155+
# Each connection may have multiple files:
156+
anonymization_files:
157+
connection_one:
158+
- './anonymizations/connection_one_1.yaml'
159+
- './anonymizations/connection_one_2.yaml'
160+
# ...
161+
```
162+
163+
:::tip
164+
Whenever you have a single unamed connection, its name will be `default`.
165+
:::
166+
167+
:::tip
168+
File paths can be relative, any relative path will be relative to this configuration
169+
file directory.
170+
:::
171+
172+
</div>
173+
174+
:::tip
175+
For more information about anonymization and configuration file structure, refer to the [Anonymization section](../anonymization/essentials).
176+
:::
177+
48178

49179
## `anonymizer_paths`
50180

@@ -65,6 +195,11 @@ db_tools:
65195
- '%kernel.project_dir%/vendor/makinacorpus/db-tools-bundle/src/Anonymizer'
66196
- '%kernel.project_dir%/src/Anonymization/Anonymizer'
67197
```
198+
199+
:::tip
200+
File paths must be absolute, use Symfony parameters to refer the project root.
201+
:::
202+
68203
</div>
69204
<div class="standalone">
70205
@@ -74,6 +209,11 @@ anonymizer_paths:
74209
- './src/Anonymization/Anonymizer'
75210
```
76211
212+
:::tip
213+
File paths can be relative, any relative path will be relative to this configuration
214+
file directory.
215+
:::
216+
77217
</div>
78218
79219
@@ -260,12 +400,20 @@ you need to add connection specific options.
260400
<div class="symfony">
261401

262402
```yaml
263-
# With connection specific options.
264403
db_tools:
265404
connections:
266405
connection_one:
267-
# ... Apply here connection-specific options.
268-
# @todo Add here all available options.
406+
# Complete list of accepted parameters follows.
407+
backup_binary: /usr/local/bin/vendor-one-dump
408+
backup_excluded_tables: ['table_one', 'table_two']
409+
backup_expiration_age: '1 month ago'
410+
backup_options: --no-table-lock
411+
backup_timeout: 2000
412+
restore_binary: /usr/local/bin/vendor-one-restore
413+
restore_options: --disable-triggers --other-option
414+
restore_timeout: 5000
415+
storage_directory: /path/to/storage
416+
storage_filename_strategy: datetime
269417
```
270418
</div>
271419
<div class="standalone">
@@ -274,10 +422,24 @@ db_tools:
274422
# With connection specific options.
275423
connections:
276424
connection_one:
425+
# Connection URL for connecting.
426+
# Please refer to makinacorpus/db-query-builder or documentation for more information.
427+
# Any URL built for doctrine/dbal usage should work.
428+
# URL is the sole mandatory parameter.
429+
# Complete list of accepted parameters follows.
277430
url: "pgsql://username:password@hostname:port?version=16.0&other_option=..."
278-
# ... Apply here connection-specific options.
279-
# @todo Add here all available options.
280-
connection_two: #...
431+
backup_binary: /usr/local/bin/vendor-one-dump
432+
backup_excluded_tables: ['table_one', 'table_two']
433+
backup_expiration_age: '1 month ago'
434+
backup_options: --no-table-lock
435+
backup_timeout: 2000
436+
restore_binary: /usr/local/bin/vendor-one-restore
437+
restore_options: --disable-triggers --other-option
438+
restore_timeout: 5000
439+
storage_directory: /path/to/storage
440+
storage_filename_strategy: datetime
441+
connection_two:
442+
#...
281443
282444
# With all default options, only database DSN.
283445
connections:
@@ -289,8 +451,18 @@ connections:
289451
connections: "pgsql://username:password@hostname:port?version=16.0&other_option=..."
290452
```
291453

454+
:::warning
455+
If you configure this parameter with a single URL string with no connection name,
456+
the connection name will be `default`.
457+
:::
458+
292459
</div>
293460

461+
:::tip
462+
All parameters for each connection are exactly the same as the top-level parameters
463+
documented in this file.
464+
:::
465+
294466

295467
## `default_connection`
296468

0 commit comments

Comments
 (0)