-
Notifications
You must be signed in to change notification settings - Fork 466
feat(configs): list configuration environment variables #4350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ParthibanRajasekaran
wants to merge
44
commits into
apache:master
Choose a base branch
from
ParthibanRajasekaran:codex/issue-4322-config-env-vars
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
3cddab7
feat(config): expose compact environment templates
ParthibanRajasekaran d842bd2
feat: list configuration environment variables
ParthibanRajasekaran 52465bd
refine config-env-vars implementation per scope requirements
ParthibanRajasekaran b98113a
chore(configs): format code per cargo fmt standards
ParthibanRajasekaran 5d2981a
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran 180fee6
fix(connectors): remove unused mut keyword
ParthibanRajasekaran 7e5172a
Merge branch 'codex/issue-4322-config-env-vars' of https://github.com…
ParthibanRajasekaran 4b88b53
refactor(configs): address CodeRabbit review findings (9 of 10)
ParthibanRajasekaran 1beda3c
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran 78dd052
feat(configs): address CodeRabbit review findings (9 of 10)
ParthibanRajasekaran ccd6e8d
Merge branch 'codex/issue-4322-config-env-vars' of https://github.com…
ParthibanRajasekaran c2eae55
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran b68f115
fix(connectors): handle stdout closure gracefully in print_config_env…
ParthibanRajasekaran 20ab3dd
Merge branch 'codex/issue-4322-config-env-vars' of https://github.com…
ParthibanRajasekaran e9feb35
fix(configs): add missing max_elements field to EnvVarTemplate struct
ParthibanRajasekaran e6fcdaa
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran 23aba20
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran 8cf0a35
fix(configs_derive): set max_elements in non-Vec nested template literal
ParthibanRajasekaran e5ed585
fix(configs): add shared print_env_var_names helper with consistent B…
ParthibanRajasekaran dca4108
test(configs): assert env_templates() and env_mappings() stay in sync
ParthibanRajasekaran f837d0d
test(integration): move config_env_listing.rs into its own module dir…
ParthibanRajasekaran 173d05a
test(integration): harden and extend config_env_listing coverage
ParthibanRajasekaran 1cb8ee7
docs: fix connectors --help clap attachment, update env-var placehold…
ParthibanRajasekaran 67f0d50
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran cb97b2d
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran a78e9d5
'EOF'fix: correct compilation errors and add missing ENABLED fields E…
ParthibanRajasekaran 5b19a78
fix: resolve merge corruption and add missing ENABLED fields EOF )"
ParthibanRajasekaran 3b2912b
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran 3062490
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran 3e4e747
fix(integration): add missing tempdir isolation to config_env_listing…
ParthibanRajasekaran cf9b0bf
Merge branch 'codex/issue-4322-config-env-vars' of https://github.com…
ParthibanRajasekaran af56297
style: apply cargo fmt formatting
ParthibanRajasekaran c0a6182
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran 47f56bb
fix(configs): improve env-var listing tests with detailed error context
ParthibanRajasekaran d874cd6
refactor(configs): make print_env_var_names testable via Write trait
ParthibanRajasekaran d529842
fix(configs): address remaining hubcio review comments
ParthibanRajasekaran d2d492a
fix(configs): address remaining hubcio review comments
ParthibanRajasekaran 0691266
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran dc5273e
fix(configs): fix McpRuntimeError Io variant and actually use test he…
ParthibanRajasekaran 27503c2
Merge branch 'master' into codex/issue-4322-config-env-vars
ParthibanRajasekaran 479cf90
fix(configs): resolve remaining simplification requests from review
ParthibanRajasekaran fe3e2f9
Merge branch 'codex/issue-4322-config-env-vars' of https://github.com…
ParthibanRajasekaran 2a44277
fix(configs): complete environment variable listing
ParthibanRajasekaran af7e26e
Address config env listing review feedback
ParthibanRajasekaran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| /// Writes each name in `names`, sorted and deduplicated, to the provided writer — one | ||
| /// call, one error policy. A closed writer (e.g. `iggy-server --list-config-env-vars | head -1`) | ||
| /// is expected, not a failure: on `BrokenPipe` this stops writing and returns `Ok(())`. Any | ||
| /// other I/O error is real and is propagated so the caller exits non-zero. | ||
| pub fn print_env_var_names<I, S, W>(names: I, writer: &mut W) -> std::io::Result<()> | ||
|
ParthibanRajasekaran marked this conversation as resolved.
|
||
| where | ||
| I: IntoIterator<Item = S>, | ||
| S: Into<String>, | ||
| W: std::io::Write, | ||
| { | ||
| let mut names: Vec<String> = names.into_iter().map(Into::into).collect(); | ||
| names.sort_unstable(); | ||
| names.dedup(); | ||
|
|
||
| for name in names { | ||
| if let Err(err) = writeln!(writer, "{name}") { | ||
| return if err.kind() == std::io::ErrorKind::BrokenPipe { | ||
| Ok(()) | ||
| } else { | ||
| Err(err) | ||
| }; | ||
| } | ||
| } | ||
| Ok(()) | ||
| } | ||
|
|
||
| pub const MCP_CONFIG_PATH_ENV: &str = "IGGY_MCP_CONFIG_PATH"; | ||
| pub const MCP_ENV_PATH_ENV: &str = "IGGY_MCP_ENV_PATH"; | ||
| /// Env vars `iggy-mcp --list-config-env-vars` advertises beyond the derived | ||
| /// `McpServerConfig` templates. | ||
| pub const MCP_RUNTIME_ENV_VARS: &[&str] = &[ | ||
| super::file_provider::DISPLAY_CONFIG_ENV, | ||
| MCP_CONFIG_PATH_ENV, | ||
| MCP_ENV_PATH_ENV, | ||
| ]; | ||
|
|
||
| pub const CONNECTORS_CONFIG_PATH_ENV: &str = "IGGY_CONNECTORS_CONFIG_PATH"; | ||
| pub const CONNECTORS_ENV_PATH_ENV: &str = "IGGY_CONNECTORS_ENV_PATH"; | ||
| /// Env vars `iggy-connectors --list-config-env-vars` advertises beyond the | ||
| /// derived `ConnectorsRuntimeConfig` templates. | ||
| pub const CONNECTORS_RUNTIME_ENV_VARS: &[&str] = &[ | ||
| CONNECTORS_CONFIG_PATH_ENV, | ||
| CONNECTORS_ENV_PATH_ENV, | ||
| super::file_provider::DISPLAY_CONFIG_ENV, | ||
| ]; | ||
|
|
||
| /// Segment between a connector env-var prefix and a plugin config field. | ||
| pub const PLUGIN_CONFIG_ENV_SEGMENT: &str = "PLUGIN_CONFIG_"; | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use std::io::{Error, ErrorKind, Write}; | ||
|
|
||
| struct FailingWriter(ErrorKind); | ||
|
|
||
| impl Write for FailingWriter { | ||
| fn write(&mut self, _: &[u8]) -> std::io::Result<usize> { | ||
| Err(Error::from(self.0)) | ||
| } | ||
|
|
||
| fn flush(&mut self) -> std::io::Result<()> { | ||
| Ok(()) | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn print_env_var_names_sorts_and_deduplicates() { | ||
| let mut output = Vec::new(); | ||
| print_env_var_names(["IGGY_B", "IGGY_A", "IGGY_B"], &mut output).unwrap(); | ||
| assert_eq!(output, b"IGGY_A\nIGGY_B\n"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn print_env_var_names_accepts_a_closed_pipe() { | ||
| assert!(print_env_var_names(["IGGY_A"], &mut FailingWriter(ErrorKind::BrokenPipe)).is_ok()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn print_env_var_names_propagates_other_write_errors() { | ||
| let error = print_env_var_names(["IGGY_A"], &mut FailingWriter(ErrorKind::StorageFull)) | ||
| .expect_err("storage-full error must be propagated"); | ||
| assert_eq!(error.kind(), ErrorKind::StorageFull); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.