Skip to content

Commit 6f8c053

Browse files
authored
Added details to the configuration documentation (absolute-quantum#66)
1 parent 8654590 commit 6f8c053

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/Resources/doc/configuration.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ To make changes to the default configuration values you will need to create the
1313
* **secret_directory_path** - Path to where the key file is stored
1414
* Default: '%kernel.project_dir%'
1515
* If **secret** is defined in the configuration make sure that **secret_directory_path** is not
16+
* **enable_secret_generation** - Defines if the secret is generated if not available
17+
* Default: true
1618
* **secret** - The secret as a string
1719
* Default: null
1820
* Suggest to use environment variables and [Symfony Secrets](https://symfony.com/doc/current/configuration/secrets.html)
@@ -32,6 +34,10 @@ ambta_doctrine_encrypt:
3234
# Default: '%kernel.project_dir%'
3335
# secret_directory_path: '%kernel.project_dir%'
3436

37+
# If the secret should be generated
38+
# Default: true
39+
# enable_secret_generation: true
40+
3541
# Secret string
3642
# secret: '%env(CRYPTO_SECRET)%'
3743
```
@@ -48,6 +54,10 @@ ambta_doctrine_encrypt:
4854
# Default: '%kernel.project_dir%'
4955
# secret_directory_path: '%kernel.project_dir%'
5056

57+
# If the secret should be generated
58+
# Default: true
59+
# enable_secret_generation: true
60+
5161
# Secret string
5262
# secret: '%env(CRYPTO_SECRET)%'
5363
```
@@ -64,6 +74,10 @@ ambta_doctrine_encrypt:
6474
# Default: '%kernel.project_dir%'
6575
secret_directory_path: '%kernel.project_dir%/keys'
6676

77+
# If the secret should be generated
78+
# Default: true
79+
# enable_secret_generation: true
80+
6781
# Secret string
6882
# secret: '%env(CRYPTO_SECRET)%'
6983
```
@@ -80,6 +94,10 @@ ambta_doctrine_encrypt:
8094
# Default: '%kernel.project_dir%'
8195
# secret_directory_path: '%kernel.project_dir%'
8296

97+
# If the secret should be generated
98+
# Default: true
99+
enable_secret_generation: false
100+
83101
# Secret string
84102
secret: '%env(CRYPTO_SECRET)%'
85103
```
@@ -96,10 +114,26 @@ ambta_doctrine_encrypt:
96114
# Default: '%kernel.project_dir%'
97115
secret_directory_path: '%kernel.project_dir%'
98116

117+
# If the secret should be generated
118+
# Default: true
119+
# enable_secret_generation: true
120+
99121
# Secret string
100122
secret: '%env(CRYPTO_SECRET)%'
101123
```
102124
125+
Be aware that there are multiple different service definitions [Yaml](/src/Resources/config).
126+
* The services.yml file is always loaded first
127+
* Then if the secret configuration setting is used services_with_secret.yml will be loaded otherwise services_with_secretfactory.yml
128+
* Symfony 5 and 6 where Doctrine ORM version matches ^3.0 service_listeners_with_attributes.yml will be loaded that does not support annotations
129+
* Symfony 5 and 6 with an older Doctrine version services_subscriber_with_annotations_and_attributes.yml will be loaded that supports both attributes and annotations
130+
* Symfony 7 always just loads attributes only service_listeners_with_attributes.yml service definition
131+
132+
If has been reported that in some cases the encryption and decryption does not work as expected and the service definitions assisted in fixing the issues.
133+
134+
One solution that have been reported was to copy the "ambta_doctrine_encrypt.orm_subscriber" definition from the service_listeners_with_attributes.yml file into
135+
the project's services.yaml file.
136+
103137
Due to the Doctrine Annotations [deprecation](https://www.doctrine-project.org/projects/doctrine-annotations/en/stable/index.html#deprecation-notice) it has been made possible to change the reader to the ambta_doctrine_attribute_reader reader only and skip using annotations completely.
104138
105139
Attributes are faster to read than annotations so it is definitely recommended.

0 commit comments

Comments
 (0)