Skip to content

Clean up shared package dependencies + env vars in PDP#428

Merged
sthanikan2000 merged 3 commits intomainfrom
refactor-pdp-packages
Jan 19, 2026
Merged

Clean up shared package dependencies + env vars in PDP#428
sthanikan2000 merged 3 commits intomainfrom
refactor-pdp-packages

Conversation

@ginaxu1
Copy link
Collaborator

@ginaxu1 ginaxu1 commented Jan 19, 2026

Summary

Refactors the PDP service, removing unused shared pckgs and standardize Env var naming, following the same pattern established in consent-engine. The changes centralize configuration management, improve code organization, and make the service more portable by removing vendor-specific naming conventions.

Type of Change

  • Refactoring (no functional changes)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Other (please describe):

Changes Made

  • Removed unused shared packages: Deleted shared/utils/, shared/config/, and shared/constants/ directories and integrated functionality directly into policy-decision-point
  • Created internal packages:
    • Added internal/config/config.go with centralized configuration management (IDPConfig, DBConfigs, ServiceConfig, LoggingConfig, SecurityConfig)
    • Created internal/utils/utils.go with common utilities previously in shared packages
  • Standardized environment variable names:
    • Database: CHOREO_OPENDIF_DATABASE_*DB_* (e.g., DB_HOST, DB_PORT, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_SSLMODE)
    • IDP: ASGARDEO_*IDP_* (e.g., IDP_ORG_NAME, IDP_ISSUER, IDP_AUDIENCE, IDP_JWKS_URL)
  • Refactored configuration loading:
    • Updated main.go to use config.LoadConfig() instead of direct environment variable access
    • Refactored v1/database.go to accept DatabaseConfigs struct instead of reading environment variables directly
    • Added structured logging with configuration details
  • Updated integration tests: Modified .github/workflows/integration-tests.yml to use new DB_* environment variables
  • Updated Dockerfile: Improved build structure to match consent-engine pattern (better layer caching)
  • Removed obsolete configuration: Deleted .choreo/component.yaml file
  • Updated documentation: Simplified README.md with standardized environment variable table

Testing

  • I have tested this change locally
  • I have added unit tests for new functionality
  • I have tested edge cases
  • All existing tests pass

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have checked that there are no merge conflicts

Related Issues

Related to #425 (consent-engine refactoring) - applies the same cleanup pattern to policy-decision-point

@ginaxu1 ginaxu1 requested review from mushrafmim and sthanikan2000 and removed request for mushrafmim January 19, 2026 07:41
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ginaxu1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the Policy Decision Point (PDP) service to enhance its maintainability, portability, and consistency with other services like consent-engine. The core changes involve centralizing configuration management, eliminating unused shared packages, and standardizing environment variable naming conventions. These updates streamline the service's internal structure, making it easier to configure and deploy across different environments by decoupling it from vendor-specific settings.

Highlights

  • Dependency Cleanup: Removed shared/utils, shared/config, and shared/constants packages, integrating their functionality directly into the policy-decision-point service.
  • Internal Package Creation: Introduced internal/config/config.go for centralized configuration management and internal/utils/utils.go for common utilities, improving code organization within the service.
  • Environment Variable Standardization: Renamed vendor-specific environment variables (e.g., CHOREO_OPENDIF_DATABASE_*, ASGARDEO_*) to generic DB_* and IDP_* patterns, enhancing portability and consistency.
  • Configuration Refactoring: Updated main.go to use the new config.LoadConfig() and v1/database.go to accept a DatabaseConfigs struct, centralizing and streamlining configuration handling.
  • Build Process and Documentation Updates: Modified the Dockerfile for improved build structure, removed the .choreo/component.yaml file, and simplified the README.md with updated environment variable tables and Go version requirements.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/integration-tests.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a substantial refactoring of the Policy Decision Point service to align it with the consent-engine service. It removes shared package dependencies, standardizes environment variables, and centralizes configuration management. The changes are well-structured and significantly improve the service's maintainability and portability. My review includes a couple of suggestions to further improve the code: one to optimize the Docker build caching and another to align a struct field name with Go's idiomatic naming conventions.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant refactoring of the PDP service to centralize configuration, standardize environment variables, and remove shared package dependencies. The changes are well-executed and improve code organization and maintainability. I've identified a few areas for improvement:

  • In the Dockerfile, there's a redundant COPY instruction that negatively impacts layer caching.
  • The new configuration loading in internal/config/config.go uses placeholder default values which could lead to hard-to-debug runtime errors.
  • There's some code duplication in v1/database.go that can be avoided.
  • An unused function was found in internal/utils/utils.go.

Overall, this is a great cleanup. Addressing these points will make the service more robust and efficient.

@ginaxu1 ginaxu1 force-pushed the refactor-pdp-packages branch 2 times, most recently from 1c6e6d2 to 466f563 Compare January 19, 2026 07:57
Copy link
Collaborator

@sthanikan2000 sthanikan2000 left a comment

Choose a reason for hiding this comment

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

When you're addressing the comments make sure to update the go.mod

@ginaxu1 ginaxu1 force-pushed the refactor-pdp-packages branch from 466f563 to 6637da4 Compare January 19, 2026 17:39
@ginaxu1 ginaxu1 requested a review from sthanikan2000 January 19, 2026 17:39
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@ginaxu1 ginaxu1 force-pushed the refactor-pdp-packages branch from 6637da4 to 041245f Compare January 19, 2026 17:41
Copy link
Collaborator

@sthanikan2000 sthanikan2000 left a comment

Choose a reason for hiding this comment

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

nit: update the .env.template as well
Remaining changes LGTM

@ginaxu1 ginaxu1 requested a review from sthanikan2000 January 19, 2026 18:51
@sthanikan2000 sthanikan2000 merged commit 8c983e5 into main Jan 19, 2026
4 checks passed
@sthanikan2000 sthanikan2000 deleted the refactor-pdp-packages branch January 19, 2026 18:54
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