Skip to content

Conversation

@gshahbazian
Copy link
Contributor

Allows injecting a cloud token and lets sample apps provide env var values.

@gshahbazian gshahbazian requested a review from itaismith December 2, 2025 22:39
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@propel-code-bot
Copy link
Contributor

Enhance CLI sample app env var injection and cloud credential reuse

This PR refines the sample app installer to pre-populate environment variables with defaults defined in config.json and to automatically inject profile-based Chroma Cloud credentials when available. It adds helper logic to detect which env vars are requested by an app, conditionally prompt the user only for remaining required values, and removes the unused hidden --dev CLI flag.

Key Changes

• Extended EnvVariable to support optional default values deserialized from sample app configs.
• Populated SampleAppEnvVariables with defaults before prompting and added selective prompting that respects cloud-supplied credentials.
• Introduced get_cloud_creds_if_available and app_requests_env helpers to pull CHROMA_API_KEY/CHROMA_TENANT from the current profile when applicable.
• Removed the hidden --dev argument from InstallArgs.

Affected Areas

• rust/cli/src/commands/install.rs

This summary was automatically generated by @propel-code-bot

Comment on lines 458 to 472
app_config
.required_env_variables
.iter()
.for_each(|env_var| {
env_variables.0.insert(env_var.name.clone(), "".to_string());
let value = env_var.default.clone().unwrap_or_default();
env_variables.0.insert(env_var.name.clone(), value);
});

app_config
.optional_env_variables
.iter()
.for_each(|env_var| {
env_variables.0.insert(env_var.name.clone(), "".to_string());
let value = env_var.default.clone().unwrap_or_default();
env_variables.0.insert(env_var.name.clone(), value);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommended

[Maintainability] To avoid repeating logic, you can chain the iterators for required_env_variables and optional_env_variables together and apply the for_each loop once. This is consistent with how chain is used in the new app_requests_env function.

Suggested change
app_config
.required_env_variables
.iter()
.for_each(|env_var| {
env_variables.0.insert(env_var.name.clone(), "".to_string());
let value = env_var.default.clone().unwrap_or_default();
env_variables.0.insert(env_var.name.clone(), value);
});
app_config
.optional_env_variables
.iter()
.for_each(|env_var| {
env_variables.0.insert(env_var.name.clone(), "".to_string());
let value = env_var.default.clone().unwrap_or_default();
env_variables.0.insert(env_var.name.clone(), value);
});
app_config
.required_env_variables
.iter()
.chain(app_config.optional_env_variables.iter())
.for_each(|env_var| {
let value = env_var.default.clone().unwrap_or_default();
env_variables.0.insert(env_var.name.clone(), value);
});
Context for Agents
To avoid repeating logic, you can chain the iterators for `required_env_variables` and `optional_env_variables` together and apply the `for_each` loop once. This is consistent with how `chain` is used in the new `app_requests_env` function.

```suggestion
    app_config
        .required_env_variables
        .iter()
        .chain(app_config.optional_env_variables.iter())
        .for_each(|env_var| {
            let value = env_var.default.clone().unwrap_or_default();
            env_variables.0.insert(env_var.name.clone(), value);
        });
```

File: rust/cli/src/commands/install.rs
Line: 472

#[clap(long, conflicts_with_all = ["name"])]
list: bool,
#[clap(long, hide = true)]
dev: Option<String>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didn't mean to completely remove this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants