Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
idavydoff committed Apr 4, 2023
1 parent bb77393 commit a028495
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 22 deletions.
18 changes: 9 additions & 9 deletions client/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
[package]
name = "cli-chat-client"
name = "tchat"
version = "0.1.0"
authors = ["Ivan Davydov [email protected]"]
license = "MIT"
description = "Client for tchat-server."
readme = "README.md"
homepage = "https://github.com/IDSaves/terminal-chat"
repository = "https://github.com/IDSaves/terminal-chat"
keywords = ["cli", "chat-client"]
categories = ["command-line-utilities"]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
6 changes: 6 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Client for tchat-server

## How to use?
0. Install CLI (```cargo install tchat```)
1. Learn options (```tchat -h```)
2. Connect to a server (```tchat -a <address>```, Example server: ```tchat -a 31.172.76.176:9005```)
20 changes: 10 additions & 10 deletions server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "cli-chat-server"
name = "tchat-server"
version = "0.1.0"
edition = "2021"

Expand Down
13 changes: 13 additions & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM rust:1.65.0 as build
ENV PKG_CONFIG_ALLOW_CROSS=1

WORKDIR /usr/src/tchat-server
COPY . .

RUN cargo install --path .

FROM gcr.io/distroless/cc-debian10

COPY --from=build /usr/local/cargo/bin/tchat-server /usr/local/bin/tchat-server

CMD ["tchat-server", "--port", "8080"]
4 changes: 3 additions & 1 deletion server/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ pub struct Service;

impl Service {
pub fn run(state: State) -> Result<()> {
let listener = TcpListener::bind(format!("127.0.0.1:{}", state.get().settings.port))?;
let listener = TcpListener::bind(format!("0.0.0.0:{}", state.get().settings.port))?;

println!("Running!");

let messages_pool = Arc::new(Mutex::new(MessagesPool::new()));

Expand Down

0 comments on commit a028495

Please sign in to comment.