Replies: 1 comment 1 reply
-
Hi, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Description
I'm trying to access environment variables defined in my
.env
file within post-request Lua scripts, butos.getenv()
returnsnil
even though the environment file is properly loaded and selected.Steps to Reproduce
Created a
.env
file with the following content:Used
:Rest env select
command to select the env fileVerified the file is loaded with
:Rest env show
(shows correct file path)Created an HTTP request with a post-script:
Expected Behavior
The post-script should print
Prod
(the value of the PLATFORM environment variable).Actual Behavior
The post-script prints
nil
.Environment
Questions
os.getenv()
the correct way to access environment variables from the.env
file in post-scripts?.env
file supposed to be available in the Lua execution context?Additional Context
{{baseurl}}
variable substitution works correctly in the request itself:Rest env show
command confirms the environment file is loadedAny guidance on the proper way to access environment variables in post-request scripts would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions