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
.envfile within post-request Lua scripts, butos.getenv()returnsnileven though the environment file is properly loaded and selected.Steps to Reproduce
Created a
.envfile with the following content:Used
:Rest env selectcommand 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.envfile in post-scripts?.envfile supposed to be available in the Lua execution context?Additional Context
{{baseurl}}variable substitution works correctly in the request itself:Rest env showcommand 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