Commit 6eeb79a8 authored by Yoann HOUPERT's avatar Yoann HOUPERT

manage env variable from docker

parent efa73fde
Pipeline #10157 passed with stage
in 1 minute and 15 seconds
......@@ -11,8 +11,8 @@
}
},
"offline": {
"host": "linsttpoc_offline_1",
"port": "5000",
"host": "linsttpoc_offline-server_1",
"port": "8888",
"api" : {
"upload" : "upload"
}
......
......@@ -24,7 +24,12 @@ module.exports = config => {
return {
transcript: (wavFile, enhancementlCallback) => {
const url = 'http://' + config.host + ':' + config.port + '/' + config.api.upload;
let port = config.port;
if (process.env.OFFLINE_PORT !== undefined) {
port = process.env.OFFLINE_PORT;
}
const url = 'http://' + config.host + ':' + port + '/' + config.api.upload;
const uiid = uuidv1();
let myUuidString = uiid.toString();
......
......@@ -44,7 +44,7 @@ const routesFactory = config => {
return res.status(interalServerCode).json({module: 'Enhancement', error: 'Error during audio enhancing'});
}
if (config.isOffline) {
if (process.env.IS_OFFLINE === 'true' || (process.env.IS_OFFLINE === undefined && config.isOffline === true)) {
offline.transcript(body, (err, response, body) => {
if (err) {
return res.status(interalServerCode).json({module: 'Offline transcription', error: 'Error during audio transcription', info: err.toString()});
......@@ -57,10 +57,7 @@ const routesFactory = config => {
return res.status(interalServerCode).json({module: 'Offline transcription', error: 'Error during audio transcription'});
}
// Default Offline
const transcription = json.transcript;
// TODO use this when enhancement whill be integrate
// const transcription = JSON.parse(json.transcript).transcript
const transcription = JSON.parse(json.transcript).transcript;
const jsonResponse = {
status: 0,
......@@ -70,7 +67,7 @@ const routesFactory = config => {
id: uuidv1()
};
return res.status(200).json({message: 'transcript done', transcript: jsonResponse});
return res.status(200).json({message: 'Transcript done', transcript: jsonResponse});
});
} else {
stt.transcript(body, (err, response, body) => {
......
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