Skip to content

Commit

Permalink
config: Make the StorageFallbackURLs a global
Browse files Browse the repository at this point in the history
  • Loading branch information
victorges committed Jun 21, 2024
1 parent 05886e5 commit 44190d9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ var ImportIPFSGatewayURLs []*url.URL

var ImportArweaveGatewayURLs []*url.URL

var StorageFallbackURLs map[string]string

var HTTPInternalAddress string
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,11 @@ func main() {
glog.Warning("DEPRECATION NOTICE: mist-user and mist-password are no longer used and will be removed in a later version")
}

// TODO: I don't love the global variables for these
// TODO: I don't love the global variables for these. Me neither.
config.ImportIPFSGatewayURLs = cli.ImportIPFSGatewayURLs
config.ImportArweaveGatewayURLs = cli.ImportArweaveGatewayURLs
config.HTTPInternalAddress = cli.HTTPInternalAddress
config.StorageFallbackURLs = cli.StorageFallbackURLs

var (
metricsDB *sql.DB
Expand Down Expand Up @@ -227,7 +228,7 @@ func main() {
}
// Start the "co-ordinator" that determines whether to send jobs to the Catalyst transcoding pipeline
// or an external one
vodEngine, err := pipeline.NewCoordinator(pipeline.Strategy(cli.VodPipelineStrategy), cli.SourceOutput, cli.ExternalTranscoder, statusClient, metricsDB, vodDecryptPrivateKey, cli.StorageFallbackURLs, cli.BroadcasterURL, cli.SourcePlaybackHosts, c2)
vodEngine, err := pipeline.NewCoordinator(pipeline.Strategy(cli.VodPipelineStrategy), cli.SourceOutput, cli.ExternalTranscoder, statusClient, metricsDB, vodDecryptPrivateKey, cli.BroadcasterURL, cli.SourcePlaybackHosts, c2)
if err != nil {
glog.Fatalf("Error creating VOD pipeline coordinator: %v", err)
}
Expand Down
9 changes: 1 addition & 8 deletions pipeline/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,11 @@ type Coordinator struct {
MetricsDB *sql.DB
InputCopy clients.InputCopier
VodDecryptPrivateKey *rsa.PrivateKey
StorageFallbackURLs map[string]string
SourceOutputURL *url.URL
C2PA *c2pa.C2PA
}

func NewCoordinator(
strategy Strategy, sourceOutputURL, extTranscoderURL string, statusClient clients.TranscodeStatusClient,
metricsDB *sql.DB, VodDecryptPrivateKey *rsa.PrivateKey, storageFallbackURLs map[string]string, broadcasterURL string,
sourcePlaybackHosts map[string]string, c2pa *c2pa.C2PA) (*Coordinator, error) {

func NewCoordinator(strategy Strategy, sourceOutputURL, extTranscoderURL string, statusClient clients.TranscodeStatusClient, metricsDB *sql.DB, VodDecryptPrivateKey *rsa.PrivateKey, broadcasterURL string, sourcePlaybackHosts map[string]string, c2pa *c2pa.C2PA) (*Coordinator, error) {
if !strategy.IsValid() {
return nil, fmt.Errorf("invalid strategy: %s", strategy)
}
Expand Down Expand Up @@ -210,14 +205,12 @@ func NewCoordinator(
Broadcaster: broadcaster,
probe: video.Probe{},
sourcePlaybackHosts: sourcePlaybackHosts,
storageFallbackURLs: storageFallbackURLs,
},
pipeExternal: &external{extTranscoder},
Jobs: cache.New[*JobInfo](),
MetricsDB: metricsDB,
InputCopy: clients.NewInputCopy(),
VodDecryptPrivateKey: VodDecryptPrivateKey,
StorageFallbackURLs: storageFallbackURLs,
SourceOutputURL: sourceOutput,
C2PA: c2pa,
}, nil
Expand Down
1 change: 0 additions & 1 deletion pipeline/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type ffmpeg struct {
Broadcaster clients.BroadcasterClient
probe video.Prober
sourcePlaybackHosts map[string]string
storageFallbackURLs map[string]string
}

func init() {
Expand Down

0 comments on commit 44190d9

Please sign in to comment.