Commit ff9850e3 authored by A. Koch's avatar A. Koch

add asset host override to config

parent 2f445243
Pipeline #1242 passed with stage
{
"assets": {
"host": "ASSETS_HOST",
"client": {
"endPoint": "ASSETS_ENDPOINT",
"port": "ASSETS_PORT",
......@@ -40,5 +41,10 @@
"apiKeys": {
"youtube": "YOUTUBE_API_KEY",
"vimeo": "VIMEO_ACCESS_TOKEN"
},
"auth": {
"jwt": {
"audience": "AUTH0_AUDIENCE"
}
}
}
......@@ -8,6 +8,7 @@
"port": 4040
},
"assets": {
"host": null,
"client": {
"endPoint": "assets.motionbank.org",
"port": 443,
......
......@@ -19,6 +19,17 @@
"dbName": "motionbank-api-acl-dev"
}
},
"assets": {
"host": null,
"client": {
"endPoint": "assets.motionbank.org",
"port": 443,
"secure": true,
"accessKey": null,
"secretKey": null
},
"bucket": "piecemaker"
},
"conversions": {
"concurrency": 1,
"redisURL": "redis://localhost:6379"
......
......@@ -11,7 +11,7 @@ class Downloads extends TinyEmitter {
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)
_this.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)
......
......@@ -37,6 +37,7 @@ class Timecodes extends TinyEmitter {
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.host || assetHost
assetHost += '/ltc'
_this._response(req, res, files.map(file => {
return `${assetHost}/${file}`
......
......@@ -30,6 +30,7 @@ class Uploads extends TinyEmitter {
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.host || assetHost
assetHost += `/${config.assets.bucket}`
_this._response(req, res, {
......
......@@ -82,6 +82,7 @@ const concatJob = async function (job) {
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.host || assetHost
assetHost += `/${config.assets.bucket}`
if (errored) return
......
......@@ -110,6 +110,7 @@ const convertJob = async function (job) {
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.host || assetHost
assetHost += `/${config.assets.bucket}`
if (errored) return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment