Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Motion Bank
Services
Transcoder
Commits
2f445243
Commit
2f445243
authored
Sep 07, 2018
by
A. Koch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix minio config parsing when external env vars are set
parent
0303046a
Pipeline
#1241
passed with stage
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
14 deletions
+40
-14
src/lib/downloads.js
src/lib/downloads.js
+4
-1
src/lib/timecodes.js
src/lib/timecodes.js
+8
-3
src/lib/uploads.js
src/lib/uploads.js
+12
-4
src/lib/workers/concat.js
src/lib/workers/concat.js
+8
-3
src/lib/workers/convert.js
src/lib/workers/convert.js
+8
-3
No files found.
src/lib/downloads.js
View file @
2f445243
...
...
@@ -8,7 +8,10 @@ class Downloads extends TinyEmitter {
super
()
const
_this
=
this
this
.
minioClient
=
new
Minio
.
Client
(
config
.
assets
.
client
)
const
opts
=
Object
.
assign
({},
config
.
assets
.
client
)
opts
.
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
opts
.
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
const
minioClient
=
new
Minio
.
Client
(
opts
)
api
.
app
.
get
(
'
/downloads/:file
'
,
async
(
req
,
res
)
=>
{
const
stream
=
await
_this
.
minioClient
.
getObject
(
config
.
assets
.
bucket
,
req
.
params
.
file
)
...
...
src/lib/timecodes.js
View file @
2f445243
...
...
@@ -14,7 +14,10 @@ class Timecodes extends TinyEmitter {
this
.
_queue
=
new
Queue
(
'
timecode
'
,
config
.
timecode
.
redisURL
)
this
.
_queue
.
process
(
parseInt
(
config
.
timecode
.
concurrency
),
require
(
'
./workers/extract-ltc
'
))
this
.
_minio
=
new
Minio
.
Client
(
config
.
assets
.
client
)
const
opts
=
Object
.
assign
({},
config
.
assets
.
client
)
opts
.
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
opts
.
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
this
.
_minio
=
new
Minio
.
Client
(
opts
)
const
_this
=
this
...
...
@@ -30,8 +33,10 @@ class Timecodes extends TinyEmitter {
stream
.
on
(
'
data
'
,
obj
=>
files
.
push
(
obj
.
name
))
stream
.
on
(
'
error
'
,
err
=>
_this
.
_errorResponse
(
res
,
500
,
err
.
message
))
stream
.
on
(
'
end
'
,
()
=>
{
let
assetHost
=
`
${
config
.
assets
.
client
.
secure
?
'
https://
'
:
'
http://
'
}${
config
.
assets
.
client
.
endPoint
}
`
if
(
config
.
assets
.
client
.
port
!==
80
&&
config
.
assets
.
client
.
port
!==
443
)
assetHost
+=
`:
${
config
.
assets
.
client
.
port
}
`
let
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
let
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
let
assetHost
=
`
${
secure
?
'
https://
'
:
'
http://
'
}${
config
.
assets
.
client
.
endPoint
}
`
if
(
port
!==
80
&&
port
!==
443
)
assetHost
+=
`:
${
port
}
`
assetHost
+=
'
/ltc
'
_this
.
_response
(
req
,
res
,
files
.
map
(
file
=>
{
return
`
${
assetHost
}
/
${
file
}
`
...
...
src/lib/uploads.js
View file @
2f445243
...
...
@@ -19,12 +19,17 @@ class Uploads extends TinyEmitter {
upload
.
single
(
'
file
'
)(
req
,
res
,
async
()
=>
{
const
extname
=
path
.
extname
(
req
.
file
.
originalname
)
const
filename
=
`
${
ObjectUtil
.
uuid4
()}${
extname
.
toLowerCase
()}
`
const
minioClient
=
new
Minio
.
Client
(
config
.
assets
.
client
)
const
opts
=
Object
.
assign
({},
config
.
assets
.
client
)
opts
.
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
opts
.
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
const
minioClient
=
new
Minio
.
Client
(
opts
)
await
minioClient
.
fPutObject
(
config
.
assets
.
bucket
,
filename
,
req
.
file
.
path
,
{
'
Content-Type
'
:
req
.
file
.
mimetype
})
let
assetHost
=
`
${
config
.
assets
.
client
.
secure
?
'
https://
'
:
'
http://
'
}${
config
.
assets
.
client
.
endPoint
}
`
if
(
config
.
assets
.
client
.
port
!==
80
&&
config
.
assets
.
client
.
port
!==
443
)
assetHost
+=
`:
${
config
.
assets
.
client
.
port
}
`
let
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
let
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
let
assetHost
=
`
${
secure
?
'
https://
'
:
'
http://
'
}${
config
.
assets
.
client
.
endPoint
}
`
if
(
port
!==
80
&&
port
!==
443
)
assetHost
+=
`:
${
port
}
`
assetHost
+=
`/
${
config
.
assets
.
bucket
}
`
_this
.
_response
(
req
,
res
,
{
...
...
@@ -35,7 +40,10 @@ class Uploads extends TinyEmitter {
})
api
.
app
.
delete
(
'
/uploads/:file
'
,
async
(
req
,
res
)
=>
{
const
minioClient
=
new
Minio
.
Client
(
config
.
assets
.
client
)
const
opts
=
Object
.
assign
({},
config
.
assets
.
client
)
opts
.
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
opts
.
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
const
minioClient
=
new
Minio
.
Client
(
opts
)
await
minioClient
.
removeObject
(
config
.
assets
.
bucket
,
req
.
params
.
file
)
_this
.
_response
(
req
,
res
)
})
...
...
src/lib/workers/concat.js
View file @
2f445243
...
...
@@ -59,7 +59,10 @@ const concatJob = async function (job) {
if
(
!
errored
)
{
try
{
const
minioClient
=
new
Minio
.
Client
(
config
.
assets
.
client
)
const
opts
=
Object
.
assign
({},
config
.
assets
.
client
)
opts
.
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
opts
.
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
const
minioClient
=
new
Minio
.
Client
(
opts
)
await
minioClient
.
fPutObject
(
config
.
assets
.
bucket
,
destFile
,
destination
,
{
'
Content-Type
'
:
'
video/mp4
'
})
await
minioClient
.
fPutObject
(
config
.
assets
.
bucket
,
thumbFile
,
thumbPath
,
{
'
Content-Type
'
:
'
image/jpeg
'
})
await
minioClient
.
fPutObject
(
config
.
assets
.
bucket
,
thumbFileSmall
,
thumbPathSmall
,
{
'
Content-Type
'
:
'
image/jpeg
'
})
...
...
@@ -75,8 +78,10 @@ const concatJob = async function (job) {
job
.
progress
(
100
)
let
assetHost
=
`
${
config
.
assets
.
client
.
secure
?
'
https://
'
:
'
http://
'
}${
config
.
assets
.
client
.
endPoint
}
`
if
(
config
.
assets
.
client
.
port
!==
80
&&
config
.
assets
.
client
.
port
!==
443
)
assetHost
+=
`:
${
config
.
assets
.
client
.
port
}
`
let
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
let
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
let
assetHost
=
`
${
secure
?
'
https://
'
:
'
http://
'
}${
config
.
assets
.
client
.
endPoint
}
`
if
(
port
!==
80
&&
port
!==
443
)
assetHost
+=
`:
${
port
}
`
assetHost
+=
`/
${
config
.
assets
.
bucket
}
`
if
(
errored
)
return
...
...
src/lib/workers/convert.js
View file @
2f445243
...
...
@@ -87,7 +87,10 @@ const convertJob = async function (job) {
if
(
!
errored
)
{
try
{
const
minioClient
=
new
Minio
.
Client
(
config
.
assets
.
client
)
const
opts
=
Object
.
assign
({},
config
.
assets
.
client
)
opts
.
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
opts
.
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
const
minioClient
=
new
Minio
.
Client
(
opts
)
await
minioClient
.
fPutObject
(
config
.
assets
.
bucket
,
destFile
,
destination
,
{
'
Content-Type
'
:
'
video/mp4
'
})
await
minioClient
.
fPutObject
(
config
.
assets
.
bucket
,
thumbFile
,
thumbPath
,
{
'
Content-Type
'
:
'
image/jpeg
'
})
await
minioClient
.
fPutObject
(
config
.
assets
.
bucket
,
thumbFileSmall
,
thumbPathSmall
,
{
'
Content-Type
'
:
'
image/jpeg
'
})
...
...
@@ -103,8 +106,10 @@ const convertJob = async function (job) {
job
.
progress
(
100
)
let
assetHost
=
`
${
config
.
assets
.
client
.
secure
?
'
https://
'
:
'
http://
'
}${
config
.
assets
.
client
.
endPoint
}
`
if
(
config
.
assets
.
client
.
port
!==
80
&&
config
.
assets
.
client
.
port
!==
443
)
assetHost
+=
`:
${
config
.
assets
.
client
.
port
}
`
let
port
=
config
.
assets
.
client
.
port
?
parseInt
(
config
.
assets
.
client
.
port
)
:
undefined
let
secure
=
config
.
assets
.
client
.
secure
&&
(
config
.
assets
.
client
.
secure
===
true
||
config
.
assets
.
client
.
secure
===
'
true
'
)
let
assetHost
=
`
${
secure
?
'
https://
'
:
'
http://
'
}${
config
.
assets
.
client
.
endPoint
}
`
if
(
port
!==
80
&&
port
!==
443
)
assetHost
+=
`:
${
port
}
`
assetHost
+=
`/
${
config
.
assets
.
bucket
}
`
if
(
errored
)
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment