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)
Fri, Oct 25, 12:05 AM
Unknown Object (File)
Fri, Oct 25, 12:05 AM
Unknown Object (File)
Fri, Oct 25, 12:05 AM
Unknown Object (File)
Fri, Oct 25, 12:04 AM
Unknown Object (File)
Fri, Oct 25, 12:04 AM
Unknown Object (File)
Fri, Oct 25, 12:04 AM
Unknown Object (File)
Fri, Oct 25, 12:04 AM
Unknown Object (File)
Sun, Oct 13, 9:19 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
Branch
varun/identity_service (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

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.