Use the pollbot server from the url
This commit is contained in:
Родитель
4502a0bb46
Коммит
418e1465fd
16
README.md
16
README.md
|
@ -90,14 +90,10 @@ which will directly fix the files that didn't pass.
|
|||
|
||||
## Using a different Pollbot server
|
||||
|
||||
By default, data is fetched from https://pollbot.services.mozilla.com/v1.
|
||||
If you want to temporary try against a different server you can override
|
||||
it on the command line with an environment variable.
|
||||
When accessing https://mozilla.github.io/delivery-dashboard/, data is fetched
|
||||
from https://pollbot.services.mozilla.com/v1, which is the production server.
|
||||
If you want to use a different server (for example the stage or dev versions),
|
||||
add a `server` query parameter like so:
|
||||
|
||||
If you want to use Pollbot's dev environment:
|
||||
|
||||
$ POLLBOT_URL=https://pollbot.dev.mozaws.net/v1 yarn start
|
||||
|
||||
Or to use the staging environment:
|
||||
|
||||
$ POLLBOT_URL=https://pollbot.stage.mozaws.net/v1 yarn start
|
||||
- dev: https://mozilla.github.io/delivery-dashboard/?server=https://pollbot.dev.mozaws.net/v1
|
||||
- stage: https://mozilla.github.io/delivery-dashboard/?server=https://pollbot.stage.mozaws.net/v1
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
"homepage": "https://mozilla.github.io/delivery-dashboard/",
|
||||
"homepage_stage": "https://mozilla.github.io/delivery-dashboard/stage/",
|
||||
"homepage_dev": "https://mozilla.github.io/delivery-dashboard/dev/",
|
||||
"pollbot": "https://pollbot.services.mozilla.com/v1",
|
||||
"pollbot_stage": "https://pollbot.stage.mozaws.net/v1",
|
||||
"scripts": {
|
||||
"start": "react-app-rewired start",
|
||||
"prestart": "yarn run version-file",
|
||||
|
@ -36,8 +34,6 @@
|
|||
"deploy": "yarn run build && gh-pages --add --dist build/",
|
||||
"deploy-dev":
|
||||
"PUBLIC_URL=$npm_package_homepage_dev yarn run deploy --dest dev/",
|
||||
"deploy-stage":
|
||||
"POLLBOT_URL=$npm_package_pollbot_stage PUBLIC_URL=$npm_package_homepage_stage yarn run deploy --dest stage/",
|
||||
"lint":
|
||||
"prettier --list-different src/**/*.js src/**/*.css | scripts/lint_problems.sh",
|
||||
"lint-fix": "prettier --write src/**/*.js src/**/*.css",
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
} from "./App";
|
||||
import { Alert, Spin, Tooltip } from "antd";
|
||||
import createStore from "./create-store";
|
||||
import { SERVER } from "./PollbotAPI";
|
||||
import { pollbotUrl } from "./index";
|
||||
import Enzyme from "enzyme";
|
||||
import Adapter from "enzyme-adapter-react-16";
|
||||
|
||||
|
@ -98,7 +98,7 @@ describe("<App />", () => {
|
|||
<ConnectedApp />
|
||||
</Provider>
|
||||
);
|
||||
expect(global.fetch).toHaveBeenCalledWith(`${SERVER}/__version__`);
|
||||
expect(global.fetch).toHaveBeenCalledWith(`${pollbotUrl}/__version__`);
|
||||
});
|
||||
it("calls requestStatus(version) with the version from the hash", () => {
|
||||
global.window.location.hash = "#pollbot/firefox/123.0";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// @flow
|
||||
import { pollbotUrl } from "./index";
|
||||
import type {
|
||||
APIVersionData,
|
||||
CheckResult,
|
||||
|
@ -7,13 +8,10 @@ import type {
|
|||
ReleaseInfo
|
||||
} from "./types";
|
||||
|
||||
export const SERVER =
|
||||
process.env.POLLBOT_URL || "https://pollbot.services.mozilla.com/v1";
|
||||
|
||||
export async function getOngoingVersions(
|
||||
product: Product
|
||||
): Promise<ProductVersions> {
|
||||
const response = await fetch(`${SERVER}/${product}/ongoing-versions`);
|
||||
const response = await fetch(`${pollbotUrl}/${product}/ongoing-versions`);
|
||||
return response.json();
|
||||
}
|
||||
|
||||
|
@ -21,7 +19,7 @@ export async function getReleaseInfo(
|
|||
product: Product,
|
||||
version: string
|
||||
): Promise<ReleaseInfo> {
|
||||
const response = await fetch(`${SERVER}/${product}/${version}`);
|
||||
const response = await fetch(`${pollbotUrl}/${product}/${version}`);
|
||||
return response.json();
|
||||
}
|
||||
|
||||
|
@ -31,6 +29,6 @@ export async function checkStatus(url: string): Promise<CheckResult> {
|
|||
}
|
||||
|
||||
export async function getPollbotVersion(): Promise<APIVersionData> {
|
||||
const response = await fetch(`${SERVER}/__version__`);
|
||||
const response = await fetch(`${pollbotUrl}/__version__`);
|
||||
return response.json();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,10 @@ import registerServiceWorker from "./registerServiceWorker";
|
|||
import { Provider } from "react-redux";
|
||||
import createStore from "./create-store";
|
||||
|
||||
const searchParams = new URLSearchParams(window.location.search);
|
||||
export const pollbotUrl =
|
||||
searchParams.get("server") || "https://pollbot.services.mozilla.com/v1";
|
||||
|
||||
const root = document && document.getElementById("root");
|
||||
|
||||
if (root) {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
const URLSearchParamsMock = {
|
||||
get(item) {
|
||||
return "https://pollbot.services.mozilla.com/v1";
|
||||
}
|
||||
};
|
||||
global.URLSearchParams = jest.fn(() => URLSearchParamsMock);
|
Загрузка…
Ссылка в новой задаче