Conversation
📝 WalkthroughWalkthroughThe changes migrate static configuration values from hardcoded constants to dynamic configuration functions that read environment variables. Two services are refactored: AffiliateProgramExportService and AffiliateStatsService, with configuration constants moved to config.ts modules featuring environment variable validation. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
| @@ -0,0 +1,27 @@ | |||
| export function getDuneQueryIds(): { | |||
There was a problem hiding this comment.
Just wondering if validation should be re-run every time we need to read the value, or if it could run only once at server startup. I've usually wrapped env variable in a class with some schema validation or something similar, but a more naive approach might be:
const duneQueryIds = getDuneQueryIds();
export const DUNE_QUERY_ID_TRADER_STATS = duneQueryIds.traderStats;
export const DUNE_QUERY_ID_AFFILIATE_STATS = duneQueryIds.affiliateStats;
The same applies to getAffiliateProgramTableName.
Minor issue, so I'm approving anyway.
There was a problem hiding this comment.
Yes, of course, the problem is that this server is also run by other teams, e.g. Aave so the behavior I wanted to achieve was to error at runtime, when hitting the endpoints, and not at start-up.
This is needed because we will have 2 sets of dashboards for each environment
Summary by CodeRabbit