Skip to content

Commit

Permalink
adding ability to specify encoding version
Browse files Browse the repository at this point in the history
  • Loading branch information
James Yeh committed Mar 29, 2017
1 parent d4d0153 commit dd86b3c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export BITMOVIN_AWS_ACCESS_KEY_ID=your.access.key.id
export BITMOVIN_AWS_SECRET_ACCESS_KEY=your.secret.access.key
export BITMOVIN_AWS_STORAGE_REGION=your.s3.region.such.as.US_EAST_1.or.EU_WEST_1
export BITMOVIN_ENCODING_REGION=your.provider.region.such.as.AWS_US_EAST_1.or.GOOGLE_EUROPE_WEST_1
export BITMOVIN_ENCODING_VERSION=STABLE.or.BETA
```


Expand Down
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type Bitmovin struct {
SecretAccessKey string `envconfig:"BITMOVIN_AWS_SECRET_ACCESS_KEY"`
AWSStorageRegion string `envconfig:"BITMOVIN_AWS_STORAGE_REGION" default:"US_EAST_1"`
EncodingRegion string `envconfig:"BITMOVIN_ENCODING_REGION" default:"AWS_US_EAST_1"`
EncodingVersion string `envconfig:"BITMOVIN_ENCODING_VERSION" default:"STABLE"`
}

// LoadConfig loads the configuration of the API using environment variables.
Expand Down
5 changes: 4 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func TestLoadConfigFromEnv(t *testing.T) {
"BITMOVIN_AWS_SECRET_ACCESS_KEY": "secret-key",
"BITMOVIN_AWS_STORAGE_REGION": "US_WEST_1",
"BITMOVIN_ENCODING_REGION": "GOOGLE_EUROPE_WEST_1",
"BITMOVIN_ENCODING_VERSION": "notstable",
"SWAGGER_MANIFEST_PATH": "/opt/video-transcoding-api-swagger.json",
"HTTP_ACCESS_LOG": accessLog,
"HTTP_PORT": "8080",
Expand Down Expand Up @@ -89,6 +90,7 @@ func TestLoadConfigFromEnv(t *testing.T) {
SecretAccessKey: "secret-key",
AWSStorageRegion: "US_WEST_1",
EncodingRegion: "GOOGLE_EUROPE_WEST_1",
EncodingVersion: "notstable",
},
Server: &server.Config{
HTTPPort: 8080,
Expand Down Expand Up @@ -118,7 +120,7 @@ func TestLoadConfigFromEnv(t *testing.T) {
}
}

func TestLoadConfigFromEnvWithDefauts(t *testing.T) {
func TestLoadConfigFromEnvWithDefaults(t *testing.T) {
os.Clearenv()
accessLog := "/var/log/transcoding-api-access.log"
setEnvs(map[string]string{
Expand Down Expand Up @@ -193,6 +195,7 @@ func TestLoadConfigFromEnvWithDefauts(t *testing.T) {
SecretAccessKey: "secret-key",
AWSStorageRegion: "US_EAST_1",
EncodingRegion: "AWS_US_EAST_1",
EncodingVersion: "STABLE",
},
Server: &server.Config{
HTTPPort: 8080,
Expand Down
8 changes: 5 additions & 3 deletions provider/bitmovin/bitmovin.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,12 @@ func (p *bitmovinProvider) Transcode(job *db.Job) (*provider.JobStatus, error) {
customData["manifest"] = manifestID
}
encodingRegion := bitmovintypes.CloudRegion(p.config.EncodingRegion)
encodingVersion := bitmovintypes.EncoderVersion(p.config.EncodingVersion)
encoding := &models.Encoding{
Name: stringToPtr("encoding"),
CustomData: customData,
CloudRegion: encodingRegion,
Name: stringToPtr("encoding"),
CustomData: customData,
CloudRegion: encodingRegion,
EncoderVersion: encodingVersion,
}

encodingResp, err := encodingS.Create(encoding)
Expand Down

0 comments on commit dd86b3c

Please sign in to comment.