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)
Sat, Dec 14, 7:42 PM
Unknown Object (File)
Sat, Dec 14, 7:42 PM
Unknown Object (File)
Sat, Dec 14, 7:42 PM
Unknown Object (File)
Sat, Dec 14, 7:41 PM
Unknown Object (File)
Sat, Dec 14, 7:31 PM
Unknown Object (File)
Mon, Nov 25, 12:08 PM
Unknown Object (File)
Mon, Nov 25, 11:13 AM
Unknown Object (File)
Nov 22 2024, 5:22 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.