Skip to content

Commit 801c5c6

Browse files
feat(*): Set some default values for configuration
1 parent 7feed60 commit 801c5c6

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

docs/configuration-reference.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
// Optional. If you use a CDN, a reverse proxy or a load balancer, set an array of IPs.
3636
// For other IPs, the bouncer will not trust the X-Forwarded-For header.
37+
// Default to empty array
3738
'trust_ip_forward_array' => [],
3839

3940
// Optional. true to enable stream mode, true to enable the stream mode. Default to false.
@@ -50,6 +51,7 @@
5051

5152
// Optional. Only for test or debug purpose.
5253
// If not empty, it will be used for all remediation and geolocation processes.
54+
// Default to empty
5355
'forced_test_ip' => '1.2.3.4',
5456

5557
// Optional. Cap the remediation to the selected one.
@@ -68,30 +70,27 @@
6870
// Optional. Set the duration we keep in cache the fact that an IP is bad. In seconds. Defaults to 20.
6971
'cache_expiration_for_bad_ip'=> '20',
7072

71-
// Optional
72-
'hide_mentions' => false
73-
7473
// Optional. Settings for geolocation remediation (i.e. country based remediation).
7574
'geolocation' => [
76-
// Optional. true to enable remediation based on country.
77-
// Default to false.
78-
'enabled' => false,
79-
// Optional. Geolocation system. Only 'maxmind' is available for the moment.
80-
// Default to 'maxmind'
81-
'type' => 'maxmind',
82-
// Optional. true to store the geolocalized country in session
83-
// Setting true will avoid multiple call to the geolocalized system (e.g. maxmind database)
84-
// Default to true.
85-
'save_in_session' => true,
86-
// Optional. MaxMind settings
87-
'maxmind' => [
88-
// Optional. Select from 'country' or 'city'.
89-
// These are the two available MaxMind database types.
90-
// Default to 'country'
91-
'database_type' => 'country',
92-
// Optional. Absolute path to the MaxMind database (mmdb file).
93-
'database_path' => '/some/path/GeoLite2-Country.mmdb',
94-
]
75+
// Optional. true to enable remediation based on country.
76+
// Default to false.
77+
'enabled' => false,
78+
// Optional. Geolocation system. Only 'maxmind' is available for the moment.
79+
// Default to 'maxmind'
80+
'type' => 'maxmind',
81+
// Optional. true to store the geolocalized country in session
82+
// Setting true will avoid multiple call to the geolocalized system (e.g. maxmind database)
83+
// Default to true.
84+
'save_in_session' => true,
85+
// Optional. MaxMind settings
86+
'maxmind' => [
87+
// Optional. Select from 'country' or 'city'.
88+
// These are the two available MaxMind database types.
89+
// Default to 'country'
90+
'database_type' => 'country',
91+
// Optional. Absolute path to the MaxMind database (mmdb file).
92+
'database_path' => '/some/path/GeoLite2-Country.mmdb',
93+
]
9594
]
9695
]
9796
$bouncer = new Bouncer();

src/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getConfigTreeBuilder(): TreeBuilder
3636
->booleanNode('debug_mode')->defaultValue(false)->end()
3737
->booleanNode('display_errors')->defaultValue(false)->end()
3838
->booleanNode('hide_mentions')->defaultValue(false)->end()
39-
->scalarNode('forced_test_ip')->end()
39+
->scalarNode('forced_test_ip')->defaultValue('')->end()
4040
->scalarNode('log_directory_path')->end()
4141
->enumNode('bouncing_level')
4242
->values([Constants::BOUNCING_LEVEL_DISABLED, Constants::BOUNCING_LEVEL_NORMAL, Constants::BOUNCING_LEVEL_FLEX])
@@ -49,7 +49,7 @@ public function getConfigTreeBuilder(): TreeBuilder
4949
->scalarNode('fs_cache_path')->end()
5050
->scalarNode('redis_dsn')->end()
5151
->scalarNode('memcached_dsn')->end()
52-
->arrayNode('trust_ip_forward_array')->end()
52+
->arrayNode('trust_ip_forward_array')->defaultValue([])->end()
5353
->enumNode('max_remediation_level')
5454
->values(Constants::ORDERED_REMEDIATIONS)
5555
->defaultValue(Constants::REMEDIATION_BAN)

0 commit comments

Comments
 (0)