Skip to content

Commit

Permalink
feat: support PLUGIN_DEBUG env
Browse files Browse the repository at this point in the history
Signed-off-by: Xin Liu <[email protected]>
  • Loading branch information
apepkuss committed May 14, 2024
1 parent de644f5 commit 3579165
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ struct Cli {

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), ServerError> {
// get the environment variable `PLUGIN_DEBUG`
let plugin_debug = std::env::var("PLUGIN_DEBUG").unwrap_or_default();
let plugin_debug = match plugin_debug.is_empty() {
true => false,
false => plugin_debug.to_lowercase().parse::<bool>().unwrap_or(false),
};

// parse the command line arguments
let cli = Cli::parse();

// log the version of the server
Expand Down Expand Up @@ -213,6 +221,7 @@ async fn main() -> Result<(), ServerError> {
.with_batch_size(cli.batch_size)
.enable_prompts_log(cli.log_prompts || cli.log_all)
.enable_plugin_log(cli.log_stat || cli.log_all)
.enable_debug_log(plugin_debug)
.build();

let chat_model_info = ModelConfig {
Expand Down Expand Up @@ -244,6 +253,7 @@ async fn main() -> Result<(), ServerError> {
.with_batch_size(cli.batch_size)
.enable_prompts_log(cli.log_prompts || cli.log_all)
.enable_plugin_log(cli.log_stat || cli.log_all)
.enable_debug_log(plugin_debug)
.build();

let embedding_model_info = ModelConfig {
Expand Down

0 comments on commit 3579165

Please sign in to comment.