Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Castopod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nate Ritter
Castopod
Commits
ce0221ee
Commit
ce0221ee
authored
4 months ago
by
Yassine Doghri
Browse files
Options
Downloads
Patches
Plain Diff
fix: allow passing json to app.proxyIPs config to set it
parent
6bdee846
Branches
develop
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/Config/App.php
+36
-2
36 additions, 2 deletions
app/Config/App.php
with
36 additions
and
2 deletions
app/Config/App.php
+
36
−
2
View file @
ce0221ee
...
...
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace
Config
;
use
CodeIgniter\Config\BaseConfig
;
use
Override
;
class
App
extends
BaseConfig
{
...
...
@@ -192,9 +193,9 @@ class App extends BaseConfig
* '192.168.5.0/24' => 'X-Real-IP',
* ]
*
* @var array<string, string>
* @var array<string, string>
|string
*/
public
array
$proxyIPs
=
[];
public
$proxyIPs
=
[];
/**
* --------------------------------------------------------------------------
...
...
@@ -249,4 +250,37 @@ class App extends BaseConfig
public
?int
$bandwidthLimit
=
null
;
public
?string
$legalNoticeURL
=
null
;
/**
* AuthToken Config Constructor
*/
public
function
__construct
()
{
parent
::
__construct
();
if
(
is_string
(
$this
->
proxyIPs
))
{
$array
=
json_decode
(
$this
->
proxyIPs
,
true
);
if
(
is_array
(
$array
))
{
$this
->
proxyIPs
=
$array
;
}
}
}
/**
* Override parent initEnvValue() to allow for direct setting to array properties values from ENV
*
* In order to set array properties via ENV vars we need to set the property to a string value first.
*
* @param mixed $property
*/
#[Override]
protected
function
initEnvValue
(
&
$property
,
string
$name
,
string
$prefix
,
string
$shortPrefix
)
:
void
{
// if attempting to set property from ENV, first set to empty string
if
(
$name
===
'proxyIPs'
&&
$this
->
getEnvValue
(
$name
,
$prefix
,
$shortPrefix
)
!==
null
)
{
$property
=
''
;
}
parent
::
initEnvValue
(
$property
,
$name
,
$prefix
,
$shortPrefix
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment