@@ -774,21 +774,39 @@ python manage.py anon_fix_permissions [--role name | --all] # Fix role permissi
774774
775775### Configuration Settings
776776
777- ``` python
778- POSTGRES_ANON = {
779- # Core settings
780- ' DEFAULT_MASKED_ROLE' : ' masked_reader' , # Default role for anonymization
781- ' ANONYMIZED_DATA_ROLE' : ' masked_reader' , # Role for anonymized_data()
782- ' MASKED_GROUP' : ' masked_users' , # Django group for middleware
783-
784- # Behavior settings
785- ' ENABLED' : True , # Enable anonymization features
786- ' AUTO_APPLY_RULES' : False , # Auto-apply when enabled
787- ' VALIDATE_FUNCTIONS' : True , # Validate function syntax
788- ' ALLOW_CUSTOM_FUNCTIONS' : False , # Allow non-anon functions
789- ' ENABLE_LOGGING' : True , # Enable audit logging
790- }
791- ```
777+ Configuration follows [ 12-factor app principles] ( https://12factor.net/config ) . Settings can be configured via:
778+
779+ 1 . ** Environment variables (recommended for production)** :
780+
781+ ``` bash
782+ export POSTGRES_ANON_ENABLED=true
783+ export POSTGRES_ANON_DEFAULT_MASKED_ROLE=masked_reader
784+ export POSTGRES_ANON_MASKED_GROUP=view_masked_data
785+ export POSTGRES_ANON_AUTO_APPLY_RULES=false
786+ export POSTGRES_ANON_VALIDATE_FUNCTIONS=true
787+ export POSTGRES_ANON_ALLOW_CUSTOM_FUNCTIONS=false
788+ export POSTGRES_ANON_ENABLE_LOGGING=true
789+ ```
790+
791+ 2 . ** Django settings (for development)** :
792+
793+ ``` python
794+ POSTGRES_ANON = {
795+ # Core settings
796+ ' DEFAULT_MASKED_ROLE' : ' masked_reader' , # Default role for anonymization
797+ ' ANONYMIZED_DATA_ROLE' : ' masked_reader' , # Role for anonymized_data()
798+ ' MASKED_GROUP' : ' masked_users' , # Django group for middleware
799+
800+ # Behavior settings
801+ ' ENABLED' : True , # Enable anonymization features
802+ ' AUTO_APPLY_RULES' : False , # Auto-apply when enabled
803+ ' VALIDATE_FUNCTIONS' : True , # Validate function syntax
804+ ' ALLOW_CUSTOM_FUNCTIONS' : False , # Allow non-anon functions
805+ ' ENABLE_LOGGING' : True , # Enable audit logging
806+ }
807+ ```
808+
809+ ** Priority** : Environment variables override Django settings, which override defaults.
792810
793811## Documentation
794812
0 commit comments