aws-amplify / aws-amplify/amplify-cli

Where can I reliabily look up the current Amplify environment in client-side code?

Open
#6,429 4 comments 4 reactions 0 assignees View on GitHub
feature-request multienv p4 platform
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

After creating a new Environment I hit on the idea that it would be nice to be able to see if you are in Dev or Live within the browser so you know if you are doing something unsafe (don't add test data to live).

I could do this by checking the url but that won't tell me which API I'm talking to, which Environment.

I started off looking into the aweexports.js file to see if I can find out which environment from there. It is possible to do by doing some string comparisons on the various API endpoints but there seems to be no offical way to do it that will work in all instances. Is there one?

If not could I suggest that the current environment is stored as a separate value in the aweexports.js file for ease of pulling out for things like this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.