Skip to content

feat(config): add credits configuration and update docker-compose ports#4355

Open
pratham-ez wants to merge 1 commit into
openmeterio:mainfrom
pratham-ez:feat/selfhost_changes
Open

feat(config): add credits configuration and update docker-compose ports#4355
pratham-ez wants to merge 1 commit into
openmeterio:mainfrom
pratham-ez:feat/selfhost_changes

Conversation

@pratham-ez
Copy link
Copy Markdown

@pratham-ez pratham-ez commented May 13, 2026

Overview

Fixes #(issue)

Notes for reviewer

Summary by CodeRabbit

  • New Features

    • Added credits configuration option to aggregation settings with enabled and enable_credit_then_invoice flags.
  • Tests

    • Added test coverage for credits configuration unmarshalling.
  • Chores

    • Exposed ClickHouse and PostgreSQL ports (127.0.0.1) in Docker Compose for local development access.

Review Change Stack

@pratham-ez pratham-ez requested a review from a team as a code owner May 13, 2026 08:44
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 024bc1be-beab-4026-ae21-cae6db365481

📥 Commits

Reviewing files that changed from the base of the PR and between 968f4d1 and 1c1f373.

📒 Files selected for processing (4)
  • app/config/config_test.go
  • app/config/credits.go
  • docker-compose.base.yaml
  • quickstart/config.yaml

📝 Walkthrough

Walkthrough

This PR enables the credits feature by adding configuration unmarshaling support through struct tags, verifying it with a new test, and setting up local development infrastructure with database port mappings and a credits example in the quickstart config.

Changes

Credits Configuration & Testing

Layer / File(s) Summary
Credits configuration struct tags and unmarshal test
app/config/credits.go, app/config/config_test.go
CreditsConfiguration struct fields now include mapstructure tags alongside existing yaml tags, enabling proper deserialization. A new TestCreditsConfigurationUnmarshal test verifies the credits config unmarshals correctly from YAML using the existing DecodeHook.
Local development infrastructure and quickstart example
docker-compose.base.yaml, quickstart/config.yaml
ClickHouse HTTP and native ports and PostgreSQL port are exposed to localhost in Docker Compose for local development access. Quickstart config includes a new credits block under aggregation with both enabled and enable_credit_then_invoice set to true.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • openmeterio/openmeter#4136: Both PRs modify app/config/credits.go to introduce/propagate the EnableCreditThenInvoice field and align tests and configuration around it.

Suggested labels

release-note/feature, area/billing

Suggested reviewers

  • tothandras
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the two main changes in the PR: adding credits configuration and updating docker-compose ports.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread quickstart/config.yaml

credits:
enabled: true
enable_credit_then_invoice: true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Credit then invoice is not supported yet, so let's not merge this until we are done with the implementation.

Comment thread docker-compose.base.yaml
nofile:
soft: 262144
hard: 262144
ports:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These are coming from docker-compose.yaml, use that for local development please.

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