Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename config-dist to conf #114

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ target
assets
package-lock.json

live777.toml
gateway.toml

# Logs
logs
*.log
Expand Down
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ Depends:
- [go](https://go.dev/)
- [redis (opt)](https://redis.io/)

If you need configuration, you can use

```bash
cp conf/live777.toml live777.toml
cp conf/gateway.toml gateway.toml
```

### WebUI

```bash
Expand Down Expand Up @@ -104,6 +111,24 @@ docker run -d --name redis --rm -p 6379:6379 redis
cargo run --package=live777-gateway
```

## How to build

```bash
# Build Web UI
bun install
bun run build

# Live777 Core
cargo build --release

# Live777 Gateway
cargo build --release --package=live777-gateway

# whipinto / whepfrom
cargo build --release --package=whipinto
cargo build --release --package=whepfrom
```

## Quickstart

### Run Live777 using docker:
Expand Down
32 changes: 32 additions & 0 deletions conf/gateway.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[http]
# Http Server Listen Address
# listen = "[::]:8888"
# Cross-Origin Resource Sharing (CORS)
# reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
# cors = false

# WHIP/WHEP auth token
# Headers["Authorization"] = "Bearer {token}"
# [auth]
# tokens = ["live777"]

# Not WHIP/WHEP standard
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#basic
# Headers["Authorization"] = "Basic {Base64.encode({username}:{password})}"
# [[auth.accounts]]
# username = "live777"
# password = "live777"

# [log]
# Env: `LOG_LEVEL`
# Default: info
# Values: off, error, warn, info, debug, trace
# level = "warn"

# [storage]
# model = "RedisStandalone"
# addr = "redis://127.0.0.1:6379"

# [reforward]
# reforward_check_frequency: 5
# check_reforward_tick_time: 3000
12 changes: 12 additions & 0 deletions conf/live777-gateway.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Live777 Cluster Gateway service
Requires=network-online.target
After=network-online.target

[Service]
Type=simple
ExecStart=/usr/bin/live777-gateway
Restart=always

[Install]
WantedBy=default.target
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions gateway/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ impl Default for CheckReforwardTickTime {

impl Config {
pub(crate) fn parse(path: Option<String>) -> Self {
let result = fs::read_to_string(path.unwrap_or_else(|| String::from("config.toml")))
.or_else(|_| fs::read_to_string("/etc/live777/gateway/config.toml"))
let result = fs::read_to_string(path.unwrap_or(String::from("gateway.toml")))
.or(fs::read_to_string("/etc/live777/gateway.toml"))
.unwrap_or("".to_string());
let cfg: Self = toml::from_str(result.as_str()).expect("config parse error");
cfg
Expand Down
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ impl From<IceServer> for RTCIceServer {

impl Config {
pub(crate) fn parse(path: Option<String>) -> Self {
let result = fs::read_to_string(path.unwrap_or_else(|| String::from("config.toml")))
.or_else(|_| fs::read_to_string("/etc/live777/config.toml"))
let result = fs::read_to_string(path.unwrap_or(String::from("live777.toml")))
.or(fs::read_to_string("/etc/live777/live777.toml"))
.unwrap_or("".to_string());
let cfg: Self = toml::from_str(result.as_str()).expect("config parse error");
match cfg.validate() {
Expand Down