Export to a .env file
Granted supports exporting temporary session credentials to a .env
file. This can be useful when using development tools that support reading environment variables from a .env
file.
To export session credentials to a .env
file, run the following command (replacing role-a
with the name of the profile you’d like to assume):
This will insert the following into your .env
file:
Internally at Common Fate we’ve found this very useful when using Granted with VS Code. When running tests in VS Code, we load environment variables from a .env
file in the repository we are working in. By running assume --env
, we can run tests without having to add much additional config to our VS Code workspace settings.