Initial project files

This commit is contained in:
Julian Laubstein 2019-02-11 09:45:14 +01:00
parent cb0d9a5517
commit 7caa714891
5 changed files with 1992 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/target
**/*.rs.bk

1942
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

11
Cargo.toml Normal file
View File

@ -0,0 +1,11 @@
[package]
name = "ragequit"
version = "0.1.0"
authors = ["Julian Laubstein <contact@julianlaubstein.de>"]
edition = "2018"
[dependencies]
actix-web = "0.7.18"
structopt = "0.2.14"
log = "0.4.6"
env_logger = "0.6.0"

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# RageQuit
A blazingly fast drop-in replacement for the Mastodon streaming api server
## Usage
```shell
$ ragequit --port 4002 # Default port is 3666
```

30
src/main.rs Normal file
View File

@ -0,0 +1,30 @@
use actix_web::{server, App, HttpRequest, Responder};
use env_logger::Builder;
use log::info;
use std::net::SocketAddr;
use structopt::StructOpt;
const ENV_LOG_VARIABLE: &str = "STREAMING_API_LOG";
#[derive(StructOpt)]
struct Opt {
#[structopt(short, long, default_value = "3666")]
port: u16,
}
fn main() {
Builder::from_env(ENV_LOG_VARIABLE).init();
let args = Opt::from_args();
info!("starting streaming api server");
server::new(|| App::new().resource("/api/v1/streaming", |r| r.with(index)))
.bind(SocketAddr::from(([127, 0, 0, 1], args.port)))
.unwrap()
.run();
}
fn index(_req: HttpRequest) -> impl Responder {
"OMG! It works!"
}