Skip to content

Commit d5e4fb9

Browse files
committed
fix: more passthrough auth
1 parent 7797d9c commit d5e4fb9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

pgdog/src/backend/databases.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Databases behind pgDog.
22
3-
use std::collections::{hash_map::Entry, HashMap};
3+
use std::collections::HashMap;
44
use std::sync::Arc;
55

66
use arc_swap::ArcSwap;
@@ -171,14 +171,20 @@ pub(crate) fn add(user: crate::config::User) -> Result<(), Error> {
171171
);
172172

173173
let mut config = config().deref().clone();
174+
let mut found = false;
174175
for existing in &mut config.users.users {
175176
if existing.name == user.name && existing.database == user.database {
177+
found = true;
176178
if existing.password().is_empty() {
177179
existing.password = user.password.clone();
178180
}
179181
}
180182
}
181183

184+
if !found {
185+
config.users.users.push(user);
186+
}
187+
182188
set(config)?;
183189
drop(lock);
184190

0 commit comments

Comments
 (0)