Moving IPs configuration into .env file

This commit is contained in:
Axel 2017-07-20 16:15:35 +02:00
parent 983166742f
commit ebd1624f03
2 changed files with 9 additions and 5 deletions

View file

@ -77,11 +77,19 @@ class Upload {
// Getting the IP limit configuration
$ips = config('sharing.upload_ip_limit');
if (empty($ips)) {
return true;
}
$ips = explode(',', $ips);
// If set and not empty, checking client's IP
if (! empty($ips) && count($ips) > 0) {
$valid = false;
foreach ($ips as $ip) {
$ip = trim($ip);
// Client's IP appears in the whitelist
if (self::isValidIp($current_ip, $ip)) {
$valid = true;

View file

@ -13,9 +13,5 @@ return [
** 3. CIDR Format (192.168.10/24) OR 1.2.3.4/255.255.255.0
** 4. Start-end IP (192.168.10.0-192.168.10.10)
*/
'upload_ip_limit' => [
'127.0.0.1'
]
'upload_ip_limit' => env('UPLOAD_LIMIT_IPS', null),
];