-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workspace builds with all features enabled
- Loading branch information
Showing
26 changed files
with
251 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[workspace] | ||
|
||
members = ["libworterbuch", "worterbuch", "worterbuch-cli"] | ||
|
||
[patch.crates-io] | ||
libworterbuch = { path = "./libworterbuch" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,14 @@ | ||
[tasks.test-server] | ||
[tasks.test-all-async] | ||
command = "cargo" | ||
args = ["test", "--no-default-features", "--features", "server,tcp,ws,graphql"] | ||
args = ["test", "--no-default-features", "--features", "tcp,ws,graphql"] | ||
|
||
[tasks.test-server-sync] | ||
[tasks.test-sync] | ||
command = "cargo" | ||
args = ["test", "--no-default-features", "--features", "server"] | ||
|
||
[tasks.test-client-tcp] | ||
command = "cargo" | ||
args = ["test", "--no-default-features", "--features", "client,tcp"] | ||
|
||
[tasks.test-client-ws] | ||
command = "cargo" | ||
args = ["test", "--no-default-features", "--features", "client,ws"] | ||
|
||
[tasks.test-client-graphql] | ||
command = "cargo" | ||
args = ["test", "--no-default-features", "--features", "client,graphql"] | ||
|
||
[tasks.test-client-sync] | ||
command = "cargo" | ||
args = ["test", "--no-default-features", "--features", "client"] | ||
args = ["test", "--no-default-features"] | ||
|
||
[tasks.test-features] | ||
dependencies = [ | ||
"test-server", | ||
"test-server-sync", | ||
"test-client-tcp", | ||
"test-client-ws", | ||
"test-client-graphql", | ||
"test-client-sync", | ||
] | ||
dependencies = ["test-all-async", "test-sync"] | ||
|
||
[tasks.docker] | ||
|
||
[tasks.docker] | ||
[tasks.install] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
use crate::error::ConfigResult; | ||
use std::env; | ||
|
||
#[derive(Debug, Clone, PartialEq)] | ||
pub struct Config { | ||
pub proto: String, | ||
pub host_addr: String, | ||
pub port: u16, | ||
} | ||
|
||
impl Config { | ||
pub fn load_env(&mut self) -> ConfigResult<()> { | ||
if let Ok(val) = env::var("WORTERBUCH_PROTO") { | ||
self.proto = val; | ||
} | ||
|
||
if let Ok(val) = env::var("WORTERBUCH_HOST_ADDRESS") { | ||
self.host_addr = val; | ||
} | ||
|
||
if let Ok(val) = env::var("WORTERBUCH_PORT") { | ||
self.port = val.parse()?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
pub fn new() -> ConfigResult<Self> { | ||
let mut config = Config::default(); | ||
config.load_env()?; | ||
Ok(config) | ||
} | ||
} | ||
|
||
impl Default for Config { | ||
fn default() -> Self { | ||
#[cfg(any(feature = "ws", feature = "graphql"))] | ||
let _proto = "ws".to_owned(); | ||
#[cfg(feature = "tcp")] | ||
let _proto = "tcp".to_owned(); | ||
#[cfg(not(any(feature = "tcp", feature = "ws", feature = "graphql")))] | ||
let _proto = "".to_owned(); | ||
|
||
let host_addr = "localhost".to_owned(); | ||
|
||
#[cfg(feature = "graphql")] | ||
let _port = 4243; | ||
#[cfg(feature = "ws")] | ||
let _port = 8080; | ||
#[cfg(feature = "tcp")] | ||
let _port = 4242; | ||
#[cfg(not(any(feature = "tcp", feature = "ws", feature = "graphql")))] | ||
let _port = 0; | ||
|
||
Config { | ||
proto: _proto, | ||
host_addr, | ||
port: _port, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
pub mod client; | ||
pub mod codec; | ||
pub mod config; | ||
pub mod error; | ||
|
||
#[cfg(feature = "client")] | ||
pub mod client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.