From 704ac44c2331a9f21e511eafe8e1de0b4632daa2 Mon Sep 17 00:00:00 2001 From: tison Date: Tue, 26 Mar 2024 14:38:33 +0800 Subject: [PATCH] Apply comments Signed-off-by: tison --- src/auth/src/user_provider.rs | 4 ++-- src/auth/src/user_provider/watch_file_user_provider.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/auth/src/user_provider.rs b/src/auth/src/user_provider.rs index e27c2a28a9..03ec034f3a 100644 --- a/src/auth/src/user_provider.rs +++ b/src/auth/src/user_provider.rs @@ -65,7 +65,7 @@ fn load_credential_from_file(filepath: &str) -> Result>> ensure!( path.exists() && path.is_file(), InvalidConfigSnafu { - value: filepath.to_string(), + value: filepath, msg: "UserProvider file must be a valid file path", } ); @@ -86,7 +86,7 @@ fn load_credential_from_file(filepath: &str) -> Result>> ensure!( !credential.is_empty(), InvalidConfigSnafu { - value: filepath.to_string(), + value: filepath, msg: "UserProvider's file must contains at least one valid credential", } ); diff --git a/src/auth/src/user_provider/watch_file_user_provider.rs b/src/auth/src/user_provider/watch_file_user_provider.rs index 6e67603597..d268cb51b6 100644 --- a/src/auth/src/user_provider/watch_file_user_provider.rs +++ b/src/auth/src/user_provider/watch_file_user_provider.rs @@ -30,6 +30,7 @@ use crate::{Identity, Password, UserInfoRef, UserProvider}; pub(crate) const WATCH_FILE_USER_PROVIDER: &str = "watch_file_user_provider"; +/// A user provider that reads user credential from a file and watches the file for changes. pub(crate) struct WatchFileUserProvider { users: Arc>>>, }