Page MenuHomePhabricator

[reports-service] Add basic config
ClosedPublic

Authored by bartek on Aug 18 2023, 12:18 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 4, 1:04 PM
Unknown Object (File)
Thu, Apr 4, 1:04 PM
Unknown Object (File)
Thu, Apr 4, 1:04 PM
Unknown Object (File)
Thu, Apr 4, 1:04 PM
Unknown Object (File)
Thu, Apr 4, 12:58 PM
Unknown Object (File)
Mar 2 2024, 12:12 PM
Unknown Object (File)
Feb 19 2024, 11:05 AM
Unknown Object (File)
Feb 19 2024, 9:40 AM
Subscribers

Details

Summary

Added standard config for localstack, logging and listening port for reports service, the same way as we do for other services.

Depends on D8864

Test Plan

cargo run, checked if cli args and localstack environment variable work

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Aug 18 2023, 6:53 AM
jon added inline comments.
services/reports/src/config.rs
18–28 ↗(On Diff #30062)

As time goes on, I feel like this is anti-pattern. It's just convenient to have a global CONFIG which you can fetch anywhere some setting out of thin air. But really, I think we should just be parsing this in main and passing the respective configuration values to the part of the code which cares about them.

For example:

let cmd_args = config::AppConfig::parse()?;
let aws_config = config::load_aws_config(cmd_args.localstack_endpoint);
start_webserver(cmd_args.http_port, &aws_config);

Since this is already an established norm, I'm not going to block on it though.

This revision is now accepted and ready to land.Aug 18 2023, 1:06 PM

I agree with @jon, this was slightly confusing to me at the beginning when I started working on the services.

This revision was automatically updated to reflect the committed changes.