Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
289521b4
Commit
289521b4
authored
Mar 01, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4217 from tdyas/redact_secret_settings
redact settings containing 'secret' besides 'password'
parents
2cf1193b
d557beb5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
pkg/setting/setting.go
+7
-2
No files found.
pkg/setting/setting.go
View file @
289521b4
...
...
@@ -169,6 +169,11 @@ func ToAbsUrl(relativeUrl string) string {
return
AppUrl
+
relativeUrl
}
func
shouldRedactKey
(
s
string
)
bool
{
uppercased
:=
strings
.
ToUpper
(
s
)
return
strings
.
Contains
(
uppercased
,
"PASSWORD"
)
||
strings
.
Contains
(
uppercased
,
"SECRET"
)
}
func
applyEnvVariableOverrides
()
{
appliedEnvOverrides
=
make
([]
string
,
0
)
for
_
,
section
:=
range
Cfg
.
Sections
()
{
...
...
@@ -180,7 +185,7 @@ func applyEnvVariableOverrides() {
if
len
(
envValue
)
>
0
{
key
.
SetValue
(
envValue
)
if
s
trings
.
Contains
(
envKey
,
"PASSWORD"
)
{
if
s
houldRedactKey
(
envKey
)
{
envValue
=
"*********"
}
appliedEnvOverrides
=
append
(
appliedEnvOverrides
,
fmt
.
Sprintf
(
"%s=%s"
,
envKey
,
envValue
))
...
...
@@ -197,7 +202,7 @@ func applyCommandLineDefaultProperties(props map[string]string) {
value
,
exists
:=
props
[
keyString
]
if
exists
{
key
.
SetValue
(
value
)
if
s
trings
.
Contains
(
keyString
,
"password"
)
{
if
s
houldRedactKey
(
keyString
)
{
value
=
"*********"
}
appliedCommandLineProperties
=
append
(
appliedCommandLineProperties
,
fmt
.
Sprintf
(
"%s=%s"
,
keyString
,
value
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment