Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suggestible
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
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
open-source
Suggestible
Commits
ee50ef2f
Commit
ee50ef2f
authored
8 months ago
by
Phil Höfer
Browse files
Options
Downloads
Patches
Plain Diff
Add db_host as Configurable Setting
parent
e7b4671b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#9975
passed
8 months ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.rs
+5
-5
5 additions, 5 deletions
src/main.rs
with
5 additions
and
5 deletions
src/main.rs
+
5
−
5
View file @
ee50ef2f
...
...
@@ -124,9 +124,9 @@ fn main() -> Result<(), io::Error> {
fn
read_from_db
(
config
:
HashMap
<
String
,
String
>
,
mut
predictor
:
SetPredictor
)
->
SetPredictor
{
let
default_password
=
&
String
::
from
(
""
);
match
config
.get
(
"db_password"
)
{
Some
(
db_password
)
=>
{
let
mut
client
=
Client
::
connect
(
format!
(
"host=
database-postgresql.metager-2
user=metager password={} dbname=postgres"
,
db_password
)
.as_str
(),
NoTls
);
match
(
config
.get
(
"db_host"
),
config
.get
(
"db_password"
)
)
{
(
Some
(
db_host
),
Some
(
db_password
)
)
=>
{
let
mut
client
=
Client
::
connect
(
format!
(
"host=
{}
user=metager password={} dbname=postgres"
,
db_host
,
db_password
)
.as_str
(),
NoTls
);
match
client
{
Ok
(
mut
c
)
=>
{
let
mut
count
=
0
;
...
...
@@ -152,8 +152,8 @@ fn read_from_db(config: HashMap<String, String>, mut predictor: SetPredictor) ->
}
}
},
None
=>
{
println!
(
"No DB
password
found. Skipping..."
);
_
=>
{
println!
(
"No DB
config
found. Skipping..."
);
predictor
}
}
...
...
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