I am trying to run a locust test but I am not able to use the .env file values
.env file contains "Value": diuqriqjqj
In the locust.py I have added
apiKey = os.environ.get("VALUE", "")
class Api(HttpUser):
wait_time = between(1, 5)
@task
def test_api(self):
self.client.get(
f"/api/test/apiKey={apiKey}"
)
I run the locust using
if test -f .env; then locust -f locust.py; fi
and receive connection errors. If I hardcode the apiKey value all works fine.
ifneq (,$(wildcard ./.env))
include .env
export
endif
env VALUE =$(VALUE) locust -f locust.py