Access Environment Type from Application Variables

I was wondering if there is a built-in way to get the environment type (dev, staging, production) from the application environment variables. I don’t see it, but would assume it should be there in some way or another. I know I can just make my own, but wanted to make sure I wasn’t just missing it.

Hello @colin

There isn’t a built-in environment type variable at the moment. We can consider implementing it as it makes sense.
cc: @Julien_Dan

1 Like

The reason I was asking is because we are using error monitoring software (e.g. Sentry) that needs the type of environment in order to classify the severity/urgency of errors.

@colin , I have a good solution for you. But before, I need to know if you are using the Ephemeral Environments (Preview Environments) or not.

Romaric.

We are not using preview envs.

So why not manually add the environment variable ENVIRONMENT_TYPE to your environments? :smiley: It could be a valid option?

That was definitely my backup plan. My only concern was that sometimes I’ll clone a staging environment and change it to a development environment. If it was a qovery built in variable I could make an alias and it would automatically change the value. Doing it manually I just might forget to change it. It’s not a big lift though, just wanted to make sure I wasn’t missing something.

You’re 100% right. We’ll plan to add this in our built in environment variables because it makes total sense.

1 Like

Hello @colin
We have introduced a new built-in variable, QOVERY_ENVIRONMENT_TYPE. Currently, it is only available for the new environments, but it will be made available on existing environments early next week.

Regards

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.