Adding user IDs to networking functions
For our networking, we must get the user ID from the auth server via the kernel. Therefore, we must declare our auth kernel with the code below:
// nanoservices/to_do/networking/actix_server/Cargo.toml
. . .
auth-kernel = { path = "../../../auth/kernel" }
[features]
auth-http = ["auth-kernel/http"]
auth-core-postgres = ["auth-kernel/core-postgres"]
default = ["auth-core-postgres"]
Here we can see that we propagate the features to the auth kernel. Therefore, if we activate the auth-http
feature the, we will interact with our auth server via HTTP. If we activate the auth-core-postgres
feature, we will be compiling the auth server into the to-do server and call the auth functions directly. The Postgres is our default.
We can see how this is implemented for the create endpoint with the following code:
// nanoservices/to_do/networking/actix_server/src
// /api/basic_actions/create.rs
. . .
use auth_kernel::api...