Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
qiuqunfeng
waf-console
Commits
99afe61b
Commit
99afe61b
authored
Jul 04, 2025
by
qiuqunfeng
Browse files
Add environment variable support for Elasticsearch and Kafka passwords in configuration loading
parent
b1f53e07
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
cmd/api-server/config/config.go
cmd/api-server/config/config.go
+10
-0
No files found.
cmd/api-server/config/config.go
View file @
99afe61b
...
...
@@ -56,5 +56,15 @@ func LoadConfig() *Config {
log
.
Err
(
err
)
.
Msg
(
"Failed to parse config file"
)
return
nil
}
esPassword
:=
os
.
Getenv
(
"ELASTIC_PASSWORD"
)
if
esPassword
!=
""
{
config
.
ElasticsearchConfig
.
Password
=
esPassword
}
kafkaPassword
:=
os
.
Getenv
(
"KAFKA_PASSWORD"
)
if
kafkaPassword
!=
""
{
config
.
KafkaConfig
.
Password
=
kafkaPassword
}
return
&
config
}
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