Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Boolean parsing for environment variables was duplicated across configuration.rs and middleware/authorization.rs using identical matches!(value.as_str(), "1" | "true" | "TRUE") patterns.

Changes

  • Extracted parse_bool_env(value: &str) -> bool helper in configuration.rs

    • Handles "1", "true", "TRUE" → true
    • All other values → false
  • Updated call sites to use the helper:

    • configuration.rs:273 - STACKER_CASBIN_RELOAD_ENABLED parsing
    • middleware/authorization.rs:38 - Same variable in policy reloader
  • Added unit tests covering true/false cases and edge cases (empty strings, mixed case, etc.)

// Before
if let Ok(enabled) = std::env::var("STACKER_CASBIN_RELOAD_ENABLED") {
    config.casbin_reload_enabled = matches!(enabled.as_str(), "1" | "true" | "TRUE");
}

// After
if let Ok(enabled) = std::env::var("STACKER_CASBIN_RELOAD_ENABLED") {
    config.casbin_reload_enabled = parse_bool_env(&enabled);
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 4, 2026 09:36
…arsing logic

Co-authored-by: vsilent <42473+vsilent@users.noreply.github.com>
Co-authored-by: vsilent <42473+vsilent@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 4, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • stackerdb
    • Triggering command: /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/rustc /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/rustc --crate-name stacker --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=120 --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test --cfg feature=&#34;default&#34; --cfg feature=&#34;indexmap&#34; --check-cfg cfg(docsrs,test) (dns block)
    • Triggering command: /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/rustc /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/rustc --crate-name stacker --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg feature=&#34;default&#34; --cfg feature=&#34;indexmap&#34; --check-cfg cfg(docsrs,test) (dns block)
    • Triggering command: /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/rustc /home/REDACTED/.rustup/toolchains/stable-x86_64-REDACTED-linux-gnu/bin/rustc --crate-name stacker --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata -C embed-bitcode=no -C debuginfo=2 --cfg feature=&#34;default&#34; --cfg feature=&#34;indexmap&#34; --check-cfg cfg(docsrs,test) (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Address feedback on user service refactoring Extract parse_bool_env helper to deduplicate boolean parsing logic Feb 4, 2026
Copilot AI requested a review from vsilent February 4, 2026 09:40
@vsilent vsilent marked this pull request as ready for review February 4, 2026 13:16
@vsilent vsilent merged commit 74a8139 into feature-user-service-refactoring Feb 4, 2026
1 check passed
@vsilent vsilent deleted the copilot/sub-pr-94-again branch February 4, 2026 13:19
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