Running prism by URL with environment vars of the project

Hello,

This topic is similar than this one but I prefer to ask in a new one because the answer will be different.

So, is it possible to run a scenario by url and with sending environment variables coming from the project?
Something like this :

https://prism.stoplight.io/?__id=xxxxxx&env=https://next-api.stoplight.io/files.export?projectId=XXXX&branch=version%2F1.0&path=.stoplight.yml&pointer=environments/staging

or more likely url-encoded like this :

https://prism.stoplight.io/?__id=xxxxxx&env=https%3A%2F%2Fnext-api.stoplight.io%2Ffiles.export%3FprojectId%3DXXXX%26branch%3Dversion%252F1.0%26path%3D.stoplight.yml%26pointer%3Denvironments%2Fstaging%0A

I tried some combinations unsuccessfully.

Hi @ntiss,

Great question, and yes! Try __envUrl instead of env. Let me know if it doesn’t work.

Thanks

1 Like

Hi @bear Thank you for the reply.

Unfortunately, it doesn’t work neither with your hosted version nor with my onPrem release (Prism multi 2.0.17-2).
The env remains empty and of course everything goes wrong :

And without encoding the url, the env isn’t empty but it’s completely stupid :
image

By the way, do you have more wonderful hidden features like this one ? (and that works :wink: )

Let me try to reproduce, this was a feature that was added a long time ago, and haven’t tested it in a very long time. I am looking at the code now, and it should be an easy fix. Couple questions, are you currently logged into Stoplight in the browser that your conducting scenarios from? That only matters if the environment is in a private project.

What wonderful thing do you want to do? I have some more secrets, but I can’t disclose them because of @marc.

Hi @bear
I use public projects for the tests and I’m already logged into Stoplight.

Regarding to the hidden features, I don’t need your secrets or the nuclear codes at Austin :wink: , but only some options like this one that are not documented and that can make Prism more integrable in any environment.
One of my recurrent need is to run Prism against a CSV file, and run the scenarios one time by line in injecting each line as environment or context parameters. Oh, it looks like this : #59 and #71. I secretly hope that this is part of your secrets.

@ntiss try again, just deployed a small fix. The envUrl wasn’t being decoded correctly. Have to use the url-encoded example you provided above.

Here’s an example

Should be faster as well too.

I have no secrets for table driven tests, unfortunately. I would love to have them. Would be really to even dynamically generate the environment variables against a schema.

1 Like

Hi @bear
Thanks a lot, it works now !

1 Like