aboutsummaryrefslogtreecommitdiff
path: root/src/resp_commands.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/resp_commands.rs')
-rw-r--r--src/resp_commands.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/resp_commands.rs b/src/resp_commands.rs
index 0fa6945..2ca9e02 100644
--- a/src/resp_commands.rs
+++ b/src/resp_commands.rs
@@ -236,7 +236,13 @@ impl RedisCommands {
}
RC::Info(_sub_command) => {
use RespType as RT;
- RT::BulkString("# Replication\r\nrole:master".as_bytes().to_vec()).to_resp_bytes()
+ let config = config.clone();
+ let mut role = "master".to_string();
+ if let Some(conf) = config.as_ref() {
+ role = conf.server.clone().role;
+ }
+ let response = format!("# Replication\r\nrole:{role}",).as_bytes().to_vec();
+ RT::BulkString(response).to_resp_bytes()
}
RC::Invalid => todo!(),
}