Skip to content

Commit

Permalink
config: eth parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
iameli committed Mar 15, 2024
1 parent 77bf6ea commit b89b22d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 16 deletions.
11 changes: 3 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,16 @@ scripts:
cp -Rv ./scripts/* ./bin

.PHONY: box-dev
box-dev: scripts
box-dev: scripts catalyst
ulimit -c unlimited \
&& exec docker run \
-v $$(realpath bin):/usr/local/bin \
-v $$(realpath data):/data \
-v $$(realpath config):/etc/livepeer:ro \
-v $$(realpath ./coredumps):$$(realpath ./coredumps) \
-e CORE_DUMP_DIR=$$(realpath ./coredumps) \
-e LP_API_CORS_JWT_ALLOWLIST="[\"http://localhost:8080\", \"http://localhost:3000\", \"http://localhost:8888\",\"http://127.0.0.1:8080\", \"http://127.0.0.1:3000\", \"http://127.0.0.1:8888\"]" \
-e LP_API_INGEST="[{\"ingest\":\"rtmp://localhost/live\",\"ingests\":{\"rtmp\":\"rtmp://localhost/live\",\"srt\":\"srt://localhost:8889\"},\"playback\":\"http://localhost:8888/hls\",\"base\":\"http://localhost:8888\",\"origin\":\"http://localhost:8888\"}]" \
-e LP_CATALYST_API_TAGS="node=media,http=http://localhost:8888/mist" \
-e LP_CATALYST_API_TOKEN=f61b3cdb-d173-4a7a-a0d3-547b871a56f9 \
-e LP_CATALYST_SECRET=f61b3cdb-d173-4a7a-a0d3-547b871a56f9 \
-e LP_LIVEPEER_ACCESS_TOKEN=f61b3cdb-d173-4a7a-a0d3-547b871a56f9 \
-e LPAUTHWEBHOOKURL=http://9c2936b5-143f-4b10-b302-6a21b5f29c3d:f61b3cdb-d173-4a7a-a0d3-547b871a56f9@127.0.0.1:3004/api/stream/hook \
-v /home/iameli/.ethereum/keystore:/keystore \
-e CATALYST_SECRET=f61b3cdb-d173-4a7a-a0d3-547b871a56f9 \
$(shell for line in $$(cat .env 2>/dev/null || echo ''); do printf -- "-e $$line "; done) \
--rm \
-it \
Expand Down
4 changes: 4 additions & 0 deletions cmd/catalyst/catalyst.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func main() {
fs.StringVar(&cli.Secret, "secret", "", "Secret UUID to secure your Catalyst node")
fs.StringVar(&cli.ConfOutput, "conf-output", "/tmp/catalyst-generated.json", "Path where we will place generated MistServer configuration")
fs.StringVar(&cli.SQLOutput, "sql-output", "/tmp/catalyst-fixtures.sql", "Path where we will generate SQL fixtures")
fs.StringVar(&cli.Network, "network", "offchain", "Network to use for transcoding. Allowed values: offchain, arbitrum-one-mainnet")
fs.StringVar(&cli.EthURL, "eth-url", "", "HTTPS URL of an Ethereum RPC provider for your selected network")
fs.StringVar(&cli.EthKeystorePath, "eth-keystore-path", "/keystore", "Path to an Ethereum keystore")
fs.StringVar(&cli.EthPassword, "eth-password", "", "Ethereum password or path to password file")

ff.Parse(
fs, os.Args[1:],
Expand Down
31 changes: 23 additions & 8 deletions cmd/catalyst/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ var vodBucketCatalystID = "00000000-0000-4000-0000-000000000003"
var privateBucketID = "00000000-0000-4000-0000-000000000004"

type Cli struct {
PublicURL string
Secret string
Verbosity string
ConfOutput string
SQLOutput string
Network string
EthURL string
Keystore string
PublicURL string
Secret string
Verbosity string
ConfOutput string
SQLOutput string
Network string
EthURL string
EthKeystorePath string
EthPassword string
}

type DBObject map[string]any
Expand Down Expand Up @@ -163,8 +164,22 @@ func tweakProtocol(protocol *Protocol, cli *Cli, u *url.URL) bool {
protocol.LivepeerAccessToken = cli.Secret
} else if protocol.Connector == "livepeer-analyzer" {
protocol.LivepeerAccessToken = cli.Secret
} else if protocol.Connector == "livepeer" && protocol.Broadcaster {
// both broadcasters
if cli.Network != "offchain" {
protocol.Network = cli.Network
protocol.EthKeystorePath = cli.EthKeystorePath
protocol.EthPassword = cli.EthPassword
protocol.EthURL = cli.EthURL
}
} else if protocol.Connector == "livepeer" && protocol.Broadcaster && protocol.MetadataQueueURI != "" {
// live broadcaster
protocol.AuthWebhookURL = fmt.Sprintf("http://%s:%s@127.0.0.1:3004/api/stream/hook", adminID, cli.Secret)
} else if protocol.Connector == "livepeer" && protocol.Orchestrator {
// if we're not offchain we shouldn't run a local O
if cli.Network != "offchain" {
return false
}
} else if protocol.Connector == "WebRTC" {
protocol.ICEServers = []ICEServer{
{
Expand Down
4 changes: 4 additions & 0 deletions cmd/catalyst/config/mist_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ type Protocol struct {
CORSJWTAllowlist string `json:"cors-jwt-allowlist,omitempty"`
LivepeerAccessToken string `json:"livepeer-access-token,omitempty"`
AuthWebhookURL string `json:"authWebhookUrl,omitempty"`
Network string `json:"network,omitempty"`
EthURL string `json:"ethUrl,omitempty"`
EthKeystorePath string `json:"ethKeystorePath,omitempty"`
EthPassword string `json:"ethPassword,omitempty"`

ICEServers []ICEServer `json:"iceservers,omitempty"`
// And finally, four ways to spell the same thing:
Expand Down

0 comments on commit b89b22d

Please sign in to comment.