Compare commits
2 commits
cc9f412a4c
...
0123d93458
Author | SHA1 | Date | |
---|---|---|---|
asonix | 0123d93458 | ||
asonix | 40246ba7fa |
694
Cargo.lock
generated
694
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
26
Cargo.toml
26
Cargo.toml
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "pict-rs-proxy"
|
name = "pict-rs-proxy"
|
||||||
description = "A simple web frontend for pict-rs"
|
description = "A simple web frontend for pict-rs"
|
||||||
version = "0.4.0-alpha.4"
|
version = "0.4.0-beta.1"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
license = "AGPL-3.0"
|
license = "AGPL-3.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -16,26 +16,26 @@ default = []
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "2.6.0"
|
actix-rt = "2.7.0"
|
||||||
actix-web = { version = "4.0.0", default-features = false }
|
actix-web = { version = "4.0.0", default-features = false }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
awc = { version = "3.0.0", default-features = false }
|
awc = { version = "3.0.0", default-features = false }
|
||||||
clap = { version = "3.1.15", features = ["derive", "env"] }
|
clap = { version = "4.0.2", features = ["derive", "env"] }
|
||||||
console-subscriber = "0.1"
|
console-subscriber = "0.1"
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
mime = "0.3"
|
mime = "0.3"
|
||||||
minify-html = "0.9.0"
|
minify-html = "0.10.0"
|
||||||
once_cell = "1.4"
|
once_cell = "1.4"
|
||||||
opentelemetry = { version = "0.17", features = ["rt-tokio"] }
|
opentelemetry = { version = "0.18", features = ["rt-tokio"] }
|
||||||
opentelemetry-otlp = "0.10"
|
opentelemetry-otlp = "0.11"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_qs = { version = "0.9", features = ["actix4"] }
|
serde_qs = { version = "0.10", features = ["actix4"] }
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
tracing-error = "0.2"
|
tracing-error = "0.2"
|
||||||
tracing-futures = "0.2"
|
tracing-futures = "0.2"
|
||||||
tracing-log = "0.1"
|
tracing-log = "0.1"
|
||||||
tracing-opentelemetry = "0.17"
|
tracing-opentelemetry = "0.18"
|
||||||
tracing-subscriber = { version = "0.3", features = [
|
tracing-subscriber = { version = "0.3", features = [
|
||||||
"ansi",
|
"ansi",
|
||||||
"env-filter",
|
"env-filter",
|
||||||
|
@ -44,16 +44,16 @@ tracing-subscriber = { version = "0.3", features = [
|
||||||
url = "2.1"
|
url = "2.1"
|
||||||
|
|
||||||
[dependencies.tracing-actix-web]
|
[dependencies.tracing-actix-web]
|
||||||
version = "0.6.0"
|
version = "0.6.1"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["emit_event_on_error", "opentelemetry_0_17"]
|
features = ["emit_event_on_error", "opentelemetry_0_18"]
|
||||||
|
|
||||||
[dependencies.tracing-awc]
|
[dependencies.tracing-awc]
|
||||||
version = "0.1.0"
|
version = "0.1.6"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["emit_event_on_error", "opentelemetry_0_17"]
|
features = ["emit_event_on_error", "opentelemetry_0_18"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
ructe = { version = "0.14.0", features = ["sass", "mime03"] }
|
ructe = { version = "0.15.0", features = ["sass", "mime03"] }
|
||||||
|
|
40
README.md
40
README.md
|
@ -7,30 +7,26 @@ _a demo frontend for pict-rs supporting noscript_
|
||||||
## Usage
|
## Usage
|
||||||
### Running
|
### Running
|
||||||
```
|
```
|
||||||
pict-rs-proxy 0.3.0-rc.3
|
$ pict-rs-proxy -h
|
||||||
|
A simple web frontend for pict-rs
|
||||||
|
|
||||||
USAGE:
|
Usage: pict-rs-proxy [OPTIONS]
|
||||||
pict-rs-proxy [OPTIONS]
|
|
||||||
|
|
||||||
FLAGS:
|
Options:
|
||||||
-h, --help Prints help information
|
-a, --addr <ADDR>
|
||||||
-V, --version Prints version information
|
The address and port the server binds to [env: PICTRS_PROXY_ADDR=] [default: 0.0.0.0:8081]
|
||||||
|
-u, --upstream <UPSTREAM>
|
||||||
OPTIONS:
|
The url of the upstream pict-rs server [env: PICTRS_PROXY_UPSTREAM=] [default: http://localhost:8080]
|
||||||
-a, --addr <addr>
|
-d, --domain <DOMAIN>
|
||||||
The address and port the server binds to [env: PICTRS_PROXY_ADDR=] [default: 0.0.0.0:8081]
|
The scheme, domain, and optional port of the pict-rs proxy server [env: PICTRS_PROXY_DOMAIN=] [default: http://localhost:8081]
|
||||||
|
--console-event-buffer-size <CONSOLE_EVENT_BUFFER_SIZE>
|
||||||
--console-event-buffer-size <console-event-buffer-size>
|
Number of events to buffer for the console subscriber. When unset, console will be disabled [env: PICTRS_PROXY_CONSOLE_BUFFER_SIZE=]
|
||||||
Number of events to buffer for the console subscriber. When unset, console will be disabled [env:
|
-o, --opentelemetry-url <OPENTELEMETRY_URL>
|
||||||
PICTRS_PROXY_CONSOLE_BUFFER_SIZE=]
|
URL of OpenTelemetry Collector [env: PICTRS_PROXY_OPENTELEMETRY_URL=]
|
||||||
-d, --domain <domain>
|
-h, --help
|
||||||
The scheme, domain, and optional port of the pict-rs proxy server [env: PICTRS_PROXY_DOMAIN=] [default:
|
Print help information
|
||||||
http://localhost:8081]
|
-V, --version
|
||||||
-o, --opentelemetry-url <opentelemetry-url>
|
Print version information
|
||||||
URL of OpenTelemetry Collector [env: PICTRS_PROXY_OPENTELEMETRY_URL=]
|
|
||||||
|
|
||||||
-u, --upstream <upstream>
|
|
||||||
The url of the upstream pict-rs server [env: PICTRS_PROXY_UPSTREAM=] [default: http://localhost:8080]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
|
@ -8,7 +8,7 @@ services:
|
||||||
- ./volumes/pictrs:/mnt
|
- ./volumes/pictrs:/mnt
|
||||||
|
|
||||||
pictrs-proxy:
|
pictrs-proxy:
|
||||||
image: asonix/pictrs-proxy:v0.3.0-alpha.14
|
image: asonix/pictrs-proxy:v0.3.0-beta.1
|
||||||
ports:
|
ports:
|
||||||
- "8081:8081"
|
- "8081:8081"
|
||||||
restart: always
|
restart: always
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -39,9 +39,11 @@ include!(concat!(env!("OUT_DIR"), "/templates.rs"));
|
||||||
const HOURS: u32 = 60 * 60;
|
const HOURS: u32 = 60 * 60;
|
||||||
const DAYS: u32 = 24 * HOURS;
|
const DAYS: u32 = 24 * HOURS;
|
||||||
|
|
||||||
|
/// Simple proxy service to demonstrate pict-rs's functionality
|
||||||
#[derive(Clone, Debug, Parser)]
|
#[derive(Clone, Debug, Parser)]
|
||||||
|
#[command(author, version, about, long_about = None)]
|
||||||
struct Config {
|
struct Config {
|
||||||
#[clap(
|
#[arg(
|
||||||
short,
|
short,
|
||||||
long,
|
long,
|
||||||
env = "PICTRS_PROXY_ADDR",
|
env = "PICTRS_PROXY_ADDR",
|
||||||
|
@ -50,7 +52,7 @@ struct Config {
|
||||||
)]
|
)]
|
||||||
addr: SocketAddr,
|
addr: SocketAddr,
|
||||||
|
|
||||||
#[clap(
|
#[arg(
|
||||||
short,
|
short,
|
||||||
long,
|
long,
|
||||||
env = "PICTRS_PROXY_UPSTREAM",
|
env = "PICTRS_PROXY_UPSTREAM",
|
||||||
|
@ -59,7 +61,7 @@ struct Config {
|
||||||
)]
|
)]
|
||||||
upstream: Url,
|
upstream: Url,
|
||||||
|
|
||||||
#[clap(
|
#[arg(
|
||||||
short,
|
short,
|
||||||
long,
|
long,
|
||||||
env = "PICTRS_PROXY_DOMAIN",
|
env = "PICTRS_PROXY_DOMAIN",
|
||||||
|
@ -68,14 +70,14 @@ struct Config {
|
||||||
)]
|
)]
|
||||||
domain: Url,
|
domain: Url,
|
||||||
|
|
||||||
#[clap(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
env = "PICTRS_PROXY_CONSOLE_BUFFER_SIZE",
|
env = "PICTRS_PROXY_CONSOLE_BUFFER_SIZE",
|
||||||
help = "Number of events to buffer for the console subscriber. When unset, console will be disabled"
|
help = "Number of events to buffer for the console subscriber. When unset, console will be disabled"
|
||||||
)]
|
)]
|
||||||
console_event_buffer_size: Option<usize>,
|
console_event_buffer_size: Option<usize>,
|
||||||
|
|
||||||
#[clap(
|
#[arg(
|
||||||
short,
|
short,
|
||||||
long,
|
long,
|
||||||
env = "PICTRS_PROXY_OPENTELEMETRY_URL",
|
env = "PICTRS_PROXY_OPENTELEMETRY_URL",
|
||||||
|
|
Loading…
Reference in a new issue