We've setup multiple environments in Prismic as per https://prismic.io/docs/environments but how can we configure our solution to point at the different endpoints in different environments.
Local dev and our staging would need one url in the sm.json file and production needs another. These would ideally come from the environment settings rather than the sm.json file.
I've tried updating the prismico.js file to get it's values from process.env.PRISMIC_API_ENDPOINT rather than sm.apiEndpoint but although the pages load it then pops up an error:
Error: An invalid Prismic Rest API V2 endpoint was provided: undefined