Page MenuHomePhabricator

[Identity] Add config for Identity service
ClosedPublic

Authored by varun on Apr 21 2022, 12:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 2, 9:57 PM
Unknown Object (File)
Thu, May 2, 2:37 PM
Unknown Object (File)
Wed, May 1, 5:37 PM
Unknown Object (File)
Wed, May 1, 5:24 PM
Unknown Object (File)
Tue, Apr 30, 8:25 PM
Unknown Object (File)
Sun, Apr 28, 3:58 PM
Unknown Object (File)
Sat, Apr 27, 10:15 PM
Unknown Object (File)
Fri, Apr 26, 3:56 PM

Details

Summary

Depends on D3799

In order to implement PAKE registration/login in the Identity service, we need to persist a secret key and then share that key with the gRPC methods that use it. In this diff I have created a config module to load the key from a file into memory and then shared the key with the gRPC methods by adding a Config struct to MyIdentityService.

Test Plan

Ran the service and tested that the relevant Config was available in MyIdentityService

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Apr 21 2022, 12:10 PM
Harbormaster failed remote builds in B8426: Diff 11758!

trigger new build after rebase

jim requested changes to this revision.Apr 26 2022, 9:57 AM
jim added inline comments.
services/identity/src/config.rs
22 ↗(On Diff #11804)

This isn't a great way to do error handling -- you're throwing away the type information...

I would make a wrapper enum with derive_more.

#[derive(Debug, derive_more::Display, derive_more::From, derive_more::Error)]
pub enum Error {
  #[display(...)]
  Pake(PakeError),
  #[display(...)]
  IO(io::Error),
}
services/identity/src/main.rs
11 ↗(On Diff #11804)

Load the config first then, MyIdentityService::new(config)

15 ↗(On Diff #11804)

Why expect? You can just return an err.

This revision now requires changes to proceed.Apr 26 2022, 9:57 AM
This revision is now accepted and ready to land.May 4 2022, 10:18 AM
This revision was automatically updated to reflect the committed changes.