Skip to content

frontend: Use backend url from env during build #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ tasks:
else: ${event.ref[11:]}
else: 'dev'

backend_url:
$if: 'tasks_for == "github-push"'
then:
$if: 'event.ref == "refs/heads/testing"'
then: 'https://api.coverage.testing.moz.tools'
else: 'https://api.coverage.moz.tools'
else: 'https://api.coverage.moz.tools'

taskboot_image: "mozilla/taskboot:0.1.9"
in:
- taskId: {$eval: as_slugid("check_lint")}
Expand Down Expand Up @@ -226,6 +234,8 @@ tasks:
payload:
maxRunTime: 3600
image: node
env:
BACKEND_URL: "${backend_url}"
command:
- sh
- -lxce
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function main(load, display, opts) {

// Coverage retrieval.

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

function cache_get(cache, key) {
if (key in cache) {
Expand Down
4 changes: 4 additions & 0 deletions frontend/webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path');
const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
Expand All @@ -18,6 +19,9 @@ module.exports = {
new MiniCssExtractPlugin({
filename: 'coverage-[hash].css',
}),
new webpack.EnvironmentPlugin({
BACKEND_URL: 'http://localhost:8000',
}),
],
module: {
rules: [
Expand Down