diff --git a/README.md b/README.md index 42e1b6b8..6725d15a 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,24 @@ Once the setup guide is complete you will be running: - `siad` configured as a Skynet Portal - an nginx webserver serving webportal + +## Web application + +### Development + +Use `yarn start` to start the development server. + +### Production build + +Use `yarn build` to compile the application to `/public` directory. + +### Build parameters + +You can use the below build parameters to customize your application. You can use them both on development and production builds. + +- development example `GATSBY_API_URL=https://siasky.dev yarn start` +- production example `GATSBY_API_URL=https://siasky.net yarn build` + +#### List of available parameters + +- `GATSBY_API_URL`: you can override the api url if it is different than the location origin diff --git a/src/LocationContext.js b/src/AppContext.js similarity index 100% rename from src/LocationContext.js rename to src/AppContext.js diff --git a/src/components/CodeExamples/CodeExamples.js b/src/components/CodeExamples/CodeExamples.js index 9334888f..83d4bc68 100644 --- a/src/components/CodeExamples/CodeExamples.js +++ b/src/components/CodeExamples/CodeExamples.js @@ -5,7 +5,7 @@ import { javascript, go, python, bash } from "react-syntax-highlighter/dist/esm/ import Colors from "./Colors"; import * as snippets from "./Code"; import "./CodeExamples.scss"; -import LocationContext from "../../LocationContext"; +import AppContext from "../../AppContext"; SyntaxHighlighter.registerLanguage("javascript", javascript); SyntaxHighlighter.registerLanguage("go", go); @@ -14,9 +14,9 @@ SyntaxHighlighter.registerLanguage("bash", bash); export default function CodeExamples() { const [active, setActive] = useState(1); - const location = useContext(LocationContext); + const { apiUrl } = useContext(AppContext); const interpolateRegExp = new RegExp("https://siasky.net", "g"); - const interpolateSnippet = snippet => snippet.replace(interpolateRegExp, location.origin); + const interpolateSnippet = snippet => snippet.replace(interpolateRegExp, apiUrl); return (