r/rust•
logophobia

Request for review: my first serious rust project (~600 lines of code)

It's an OpenID reverse proxy for the client credentials flow. Basically a proxy that can protect http based APIs with the OpenID protocol. Uses actix-web. Doesn't support all of OpenID, only what is relevant for the client credentials flow with bearer tokens.

Repository: https://github.com/logophobia/clientcredentials-proxy-tmp

Posted Sep 28, 2018, 4:34 PM UTC · edited

136
JoshMcguigan•

Thanks for sharing your code. Just an FYI, the standard when asking for a code review of something with multiple files like this would be to post a link to a repo with the full project, so the reviewer can easily clone it and review/run the tests/run it locally.

6
logophobiaOP•

Thank you, done.

2
daborossfern•

Could you post a GitHub or GitLab repository with everything set up to cargo run or cargo doc?

You're much likely to get good reviewers if you can make it a bit easier to get to the code and work with it.

If you need any help setting up a repository, let me know.

4
logophobiaOP•

Thank you, just created a repository.

2
Snakehand•

Immediate comment - use a toml file for config instead of a slew of environmental variables.

Optional parameters can be made as Option<T> in your config struct. Use serde & toml crate to read the file, and then you can pass the config struct around as you please (as it is non mutable)

3
logophobiaOP•

I was using environment variables because it's a bit easier to use with docker. Might be a good idea to add some options (toml, cli arguments..).

Edit: The "config" crate seems to support multiple configuration sources at once, I'll probably start using that.

6