aerogear / datasync-starter

GraphQL Low Code React and Node.js DataSync Application template
http://graphback.dev
MIT License
32 stars 38 forks source link

fix: add ability to define server url at build time #317

Closed darahayes closed 4 years ago

darahayes commented 4 years ago

Description

This PR makes it possible to point the client app to a given server url (specified at build time)

Examples of how this works with our current npm scripts

REACT_APP_SERVER_URL=https://some-domain.com/graphql yarn start

or

REACT_APP_SERVER_URL=https://some-domain.com/graphql yarn build

There's a little bit of cleverness there to set the websocket url based on the http url provided also. This is a pretty canonical way to do this in react applications over static config files that are being checked into the repo. See https://create-react-app.dev/docs/adding-custom-environment-variables/

Checklist
wtrocki commented 4 years ago

Added small change as it will not work for http