Skip to content

Commit b08b427

Browse files
La0marco-c
authored andcommitted
frontend: Use backend url from env during build (#142)
1 parent 247a0a3 commit b08b427

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

.taskcluster.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ tasks:
4141
else: ${event.ref[11:]}
4242
else: 'dev'
4343

44+
backend_url:
45+
$if: 'tasks_for == "github-push"'
46+
then:
47+
$if: 'event.ref == "refs/heads/testing"'
48+
then: 'https://api.coverage.testing.moz.tools'
49+
else: 'https://api.coverage.moz.tools'
50+
else: 'https://api.coverage.moz.tools'
51+
4452
taskboot_image: "mozilla/taskboot:0.1.9"
4553
in:
4654
- taskId: {$eval: as_slugid("check_lint")}
@@ -226,6 +234,8 @@ tasks:
226234
payload:
227235
maxRunTime: 3600
228236
image: node
237+
env:
238+
BACKEND_URL: "${backend_url}"
229239
command:
230240
- sh
231241
- -lxce

frontend/src/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export async function main(load, display, opts) {
3636

3737
// Coverage retrieval.
3838

39-
const COVERAGE_BACKEND_HOST = 'https://api.coverage.moz.tools';
39+
const COVERAGE_BACKEND_HOST = process.env.BACKEND_URL;
4040

4141
function cache_get(cache, key) {
4242
if (key in cache) {

frontend/webpack.common.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
const webpack = require('webpack');
23
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
34
const HtmlWebpackPlugin = require('html-webpack-plugin')
45
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
@@ -18,6 +19,9 @@ module.exports = {
1819
new MiniCssExtractPlugin({
1920
filename: 'coverage-[hash].css',
2021
}),
22+
new webpack.EnvironmentPlugin({
23+
BACKEND_URL: 'http://localhost:8000',
24+
}),
2125
],
2226
module: {
2327
rules: [

0 commit comments

Comments
 (0)