update readme sandbox instructions

- make readme have an example of running a server
- fix github CI so that it accomodates for TLS/no-TLS configurations
This commit is contained in:
ayham 2021-05-30 21:35:41 +03:00
parent d32140ceb7
commit 21a9ca3724
Signed by: ayham
GPG Key ID: EAB7F5A9DF503678
4 changed files with 12 additions and 15 deletions

View File

@ -17,11 +17,11 @@ jobs:
run: cargo fmt --all -- --check
- name: Build Minimal
run: cargo build --no-default-features
- name: Build Client
- name: Build Client with TLS verification
run: cargo build --no-default-features --features "client"
- name: Build Client without TLS verification
run: cargo build --no-default-features --features "client,tls_no_verify"
- name: Build Server
run: cargo build --no-default-features --features "server"
- name: Build Hybrid
run: cargo build --no-default-features --features "server,client"
- name: Run benches
run: cargo bench

View File

@ -25,17 +25,13 @@ Build command, Hybrid:
$ cargo build --no-default-features --features "server,client"
```
Running server/client (depends on your build command):
```shell
$ ./target/debug/sandbox
```
Running sandbox:
```shell
$ sudo ./scripts/remove_db.sh
$ sudo ./scripts/deploy_sandbox.sh
$ cargo run --features "server,tls_no_verify" &
$ cargo run --features "client,tls_no_verify" &
$ cargo run --no-default-features --features "server" -- 0.0.0.0:4000
--cert certs/certificate.crt --key private.key &
$ cargo run --no-default-features --features "client,tls_no_verify" &
```
## Built With

View File

@ -7,9 +7,9 @@ use crate::common::message::message_builder::message_builder;
use crate::common::message::message_type::MessageType;
use crate::common::misc::return_flags::ReturnFlags;
use crate::server::network::jwt_wrapper::verify_jwt_token;
use crate::server::db::config::{DB_PORTFOLIO_USER, DB_PORTFOLIO_PASS};
use crate::server::db::config::{DB_PORTFOLIO_PASS, DB_PORTFOLIO_USER};
use crate::server::db::initializer::db_connect;
use crate::server::network::jwt_wrapper::verify_jwt_token;
use tokio::io::AsyncWriteExt;
use tokio::net::TcpStream;
@ -32,7 +32,7 @@ pub async fn acc_retrieve_portfolio(
/* connect to SQL database using user ```postfolio_schema_user``` */
let sql_conn = db_connect(DB_PORTFOLIO_USER, DB_PORTFOLIO_PASS)
.await
.map_err(|_| {ReturnFlags::ServerRetrievePortfolioFailed})?;
.map_err(|_| ReturnFlags::ServerRetrievePortfolioFailed)?;
/* get userId's portfolio positions */
let mut portfolio: Portfolio = Portfolio::default();

View File

@ -53,9 +53,10 @@ pub async fn acc_retrieve_transaction(
0,
bincode::serialize(&transactions).unwrap(),
);
socket.write_all(&bincode::serialize(&message).unwrap())
socket
.write_all(&bincode::serialize(&message).unwrap())
.await
.map_err(|_| {ReturnFlags::ServerRetrieveTransactionFailed})?;
.map_err(|_| ReturnFlags::ServerRetrieveTransactionFailed)?;
Ok(())
}