Skip to content

Commit

Permalink
rename config-dist to conf/
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Apr 23, 2024
1 parent 590d155 commit b97be5e
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 4 deletions.
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_else(|| String::from("gateway.toml")))
.or_else(|_| 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_else(|| String::from("live777.toml")))
.or_else(|_| 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

0 comments on commit b97be5e

Please sign in to comment.