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

gateway: ai authWebhook: send gatewayHost to auth webhook #3320

Merged
merged 7 commits into from
Dec 17, 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
1 change: 1 addition & 0 deletions cmd/livepeer/livepeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func parseLivepeerConfig() starter.LivepeerConfig {
cfg.IgnoreMaxPriceIfNeeded = flag.Bool("ignoreMaxPriceIfNeeded", *cfg.IgnoreMaxPriceIfNeeded, "Set to true to allow exceeding max price condition if there is no O that meets this requirement")
cfg.MinPerfScore = flag.Float64("minPerfScore", *cfg.MinPerfScore, "The minimum orchestrator's performance score a broadcaster is willing to accept")
cfg.DiscoveryTimeout = flag.Duration("discoveryTimeout", *cfg.DiscoveryTimeout, "Time to wait for orchestrators to return info to be included in transcoding sessions for manifest (default = 500ms)")
cfg.GatewayHost = flag.String("gatewayHost", *cfg.GatewayHost, "External hostname on which the Gateway node is running. Used when telling external services how to reach the node.")

// Transcoding:
cfg.Orchestrator = flag.Bool("orchestrator", *cfg.Orchestrator, "Set to true to be an orchestrator")
Expand Down
7 changes: 7 additions & 0 deletions cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
Netint *string
HevcDecoding *bool
TestTranscoder *bool
GatewayHost *string
EthAcctAddr *string
EthPassword *string
EthKeystorePath *string
Expand Down Expand Up @@ -215,6 +216,7 @@
defaultAIRunnerImage := "livepeer/ai-runner:latest"
defaultLiveAIAuthWebhookURL := ""
defaultLivePaymentInterval := 5 * time.Second
defaultGatewayHost := ""

Check warning on line 219 in cmd/livepeer/starter/starter.go

View check run for this annotation

Codecov / codecov/patch

cmd/livepeer/starter/starter.go#L219

Added line #L219 was not covered by tests

// Onchain:
defaultEthAcctAddr := ""
Expand Down Expand Up @@ -323,6 +325,7 @@
AIRunnerImage: &defaultAIRunnerImage,
LiveAIAuthWebhookURL: &defaultLiveAIAuthWebhookURL,
LivePaymentInterval: &defaultLivePaymentInterval,
GatewayHost: &defaultGatewayHost,

Check warning on line 328 in cmd/livepeer/starter/starter.go

View check run for this annotation

Codecov / codecov/patch

cmd/livepeer/starter/starter.go#L328

Added line #L328 was not covered by tests

// Onchain:
EthAcctAddr: &defaultEthAcctAddr,
Expand Down Expand Up @@ -1414,6 +1417,10 @@
*cfg.HttpAddr = defaultAddr(*cfg.HttpAddr, "127.0.0.1", BroadcasterRpcPort)
*cfg.CliAddr = defaultAddr(*cfg.CliAddr, "127.0.0.1", BroadcasterCliPort)

if *cfg.GatewayHost != "" {
n.GatewayHost = *cfg.GatewayHost
}

Check warning on line 1422 in cmd/livepeer/starter/starter.go

View check run for this annotation

Codecov / codecov/patch

cmd/livepeer/starter/starter.go#L1420-L1422

Added lines #L1420 - L1422 were not covered by tests

bcast := core.NewBroadcaster(n)
orchBlacklist := parseOrchBlacklist(cfg.OrchBlacklist)
if *cfg.OrchPerfStatsURL != "" && *cfg.Region != "" {
Expand Down
3 changes: 3 additions & 0 deletions core/livepeernode.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ type LivepeerNode struct {
LiveAITrickleHostForRunner string
LiveAIAuthApiKey string
LivePaymentInterval time.Duration

// Gateway
GatewayHost string
}

type LivePipeline struct {
Expand Down
1 change: 1 addition & 0 deletions server/ai_mediaserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@
Stream: streamName,
Type: sourceTypeStr,
QueryParams: queryParams,
GatewayHost: ls.LivepeerNode.GatewayHost,

Check warning on line 449 in server/ai_mediaserver.go

View check run for this annotation

Codecov / codecov/patch

server/ai_mediaserver.go#L449

Added line #L449 was not covered by tests
})
if err != nil {
kickErr := mediaMTXClient.KickInputConnection(ctx)
Expand Down
3 changes: 3 additions & 0 deletions server/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ type AIAuthRequest struct {
// Query parameters that came with the stream, if any
QueryParams string `json:"query_params,omitempty"`

// Gateway host
GatewayHost string `json:"gateway_host"`

// TODO not sure what params we need yet
}

Expand Down
Loading