Skip to content

Refactor configuration module to use confique for environment variable management#267

Merged
danyi1212 merged 2 commits intorelease/0.9.0from
dan/per-12291-pdp-refactor-config-module
Jun 5, 2025
Merged

Refactor configuration module to use confique for environment variable management#267
danyi1212 merged 2 commits intorelease/0.9.0from
dan/per-12291-pdp-refactor-config-module

Conversation

@danyi1212
Copy link
Contributor

No description provided.

@danyi1212 danyi1212 requested a review from omer9564 June 3, 2025 13:17
@danyi1212 danyi1212 self-assigned this Jun 3, 2025
Copy link
Contributor

@omer9564 omer9564 left a comment

Choose a reason for hiding this comment

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

approved with one concern about the maintenance of the new crate

pub struct CacheConfig {
/// Cache TTL in seconds (default: 1 hour)
#[serde(default)]
#[config(env = "PDP_CACHE_TTL", default = 3600)]
Copy link
Contributor

Choose a reason for hiding this comment

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

there isn't a prefix implementation or auto env generation here ?

/// In-memory cache specific configuration
#[serde(default)]
#[config(nested)]
pub memory: InMemoryConfig,
Copy link
Contributor

Choose a reason for hiding this comment

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

you used to have default of ::default() here, what will happen here ?

/// In-memory cache specific configuration
#[serde(default)]
#[config(nested)]
pub memory: InMemoryConfig,
Copy link
Contributor

Choose a reason for hiding this comment

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

you used to have default of ::default() here, what will happen here ?

/// Debug mode (injects debug attributes to OPA requests)
#[serde(default)]
#[config(env = "PDP_DEBUG")]
pub debug: Option<bool>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it automatically inject None ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that confique has a more elegant interface ( in some cases ).
Not sure what I think about it tho due to its lack of many features such as prefix, auto env var creation, and most importantly a maintenance, the last commit was 8 months ago.

- Updated the health check test setup to use the provided configuration directly instead of cloning it.
- Added a new test for health check success timing to validate the behavior with an increased timeout.
- Enhanced logging setup for better visibility during test execution.
@danyi1212 danyi1212 merged commit be38720 into release/0.9.0 Jun 5, 2025
5 checks passed
@danyi1212 danyi1212 deleted the dan/per-12291-pdp-refactor-config-module branch June 5, 2025 11:25
danyi1212 added a commit that referenced this pull request Jun 8, 2025
…e management (#267)

* Refactor configuration module to use confique for environment variable management

* Fixed health check tests

- Updated the health check test setup to use the provided configuration directly instead of cloning it.
- Added a new test for health check success timing to validate the behavior with an increased timeout.
- Enhanced logging setup for better visibility during test execution.
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