remove unneeded cmdline args, cert & key
continuous-integration/drone/push Build is passing Details

those are not needed to be in supplied from the command line,
moved to env.sh
This commit is contained in:
ayham 2021-07-30 08:12:16 +03:00
parent 4a7bded35f
commit 2470a7ccf8
Signed by: ayham
GPG Key ID: EAB7F5A9DF503678
4 changed files with 9 additions and 13 deletions

View File

@ -1,3 +1,3 @@
#!/bin/sh
. ./scripts/env.sh && cargo run --no-default-features --features "server" -- ${1:-0.0.0.0:4000} --cert certs/certificate.crt --key certs/private.key
. ./scripts/env.sh && cargo run --no-default-features --features "server" -- ${1:-0.0.0.0:4000}

View File

@ -1,5 +1,8 @@
#!/bin/sh
export CONFIG_CERT_FILE="./certs/certificate.crt"
export CONFIG_KEY_FILE="./certs/private.key"
export DB_HOST="database"
[ -z "$CI_DEPLOY" ] && export DB_HOST="localhost"

View File

@ -1,6 +1,6 @@
use std::io;
use std::net::ToSocketAddrs;
use std::path::PathBuf;
use std::path::Path;
use std::sync::Arc;
use argh::FromArgs;
@ -21,14 +21,6 @@ struct Options {
/// bind addr
#[argh(positional)]
addr: String,
/// cert file
#[argh(option, short = 'c')]
cert: PathBuf,
/// key file
#[argh(option, short = 'k')]
key: PathBuf,
}
tokio::task_local! {
@ -159,7 +151,8 @@ pub async fn libtrader_init_server() -> std::io::Result<()> {
.next()
.ok_or_else(|| std::io::Error::from(std::io::ErrorKind::AddrNotAvailable))?;
let config = gen_tls_server_config(&options.cert, &options.key)?;
let config = gen_tls_server_config(&Path::new(&std::env::var("CONFIG_CERT_FILE").unwrap()),
&Path::new(&std::env::var("CONFIG_KEY_FILE").unwrap()))?;
let acceptor = TlsAcceptor::from(config);
let listener = TcpListener::bind(&addr).await?;

View File

@ -1,6 +1,5 @@
## To do
- use env.sh or arguments
- server move network code to somewhere plausable.
- create correct modules
- data implmentation stuff
@ -19,7 +18,7 @@
## In progress
- configure drone ci
- use env.sh or arguments
## Done
@ -141,3 +140,4 @@
* [x] Saving/Loading stock values
* [x] Saving/Loading profiles/portfolios
* [x] Saving/Loading company values
- configure drone ci