---
title: 'Environment Variable?'
url: 'https://getgrav.org/forum/archive/environment-variable-t274'
markdown: 'https://getgrav.org/forum/archive/environment-variable-t274.md'
date: '2026-06-21'
description: 'Does Grav have an environment variable, accessible via Twig, that can return the operating environment: production or development? If not, is there a way to'
---

[Archive](https://getgrav.org/forum/archive)

#  Environment Variable? 

  Started by Muut Archive 12 years ago · 5 replies · 728 views    

 [12 years ago](https://getgrav.org/forum/archive/environment-variable-t274#post-2244 "Permalink") 

Does Grav have an environment variable, accessible via Twig, that can return the operating environment: production or development?

If not, is there a way to set such a variable in a site specific configuration file?

 [12 years ago](https://getgrav.org/forum/archive/environment-variable-t274#post-2245 "Permalink") 

Currently its not really accessible via twig. It's determined in the ConfigServiceProvider.php file. I think this could be valuable though, so stand by!

 [12 years ago](https://getgrav.org/forum/archive/environment-variable-t274#post-2246 "Permalink") 

Ok, i've moved this logic to the URI object, so if you are able to update to the current GitHub version, you will be able to do this `{{ uri.environment }}` to output the current environment

Commit: <https://github.com/getgrav/grav/commit/78279e4d7a61df93afe6371546648a035bc6992d>

 [12 years ago](https://getgrav.org/forum/archive/environment-variable-t274#post-2247 "Permalink") 

BTW this is going to be `localhost` or `www.myserver.com`. These are the same values that Grav uses to differentiate the configuration settings.

 [12 years ago](https://getgrav.org/forum/archive/environment-variable-t274#post-2248 "Permalink") 

I would just need ConfigServiceProvider.php?

 [12 years ago](https://getgrav.org/forum/archive/environment-variable-t274#post-2249 "Permalink") 

actually you would only *need* to grab the updated `Uri.php`.

[Log in](https://getgrav.org/login?return=%2Fforum%2Farchive%2Fenvironment-variable-t274) to reply.

###  Suggested topics

 | Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| [About the Archive category](https://getgrav.org/forum/archive/about-the-archive-category-t6942)    [Archive](https://getgrav.org/forum/archive) · by Deleted User, 9 years ago |  | 0 | 2853 | [9 years ago](https://getgrav.org/forum/archive/about-the-archive-category-t6942 "by Deleted User") |
| [Hey buddies!](https://getgrav.org/forum/archive/hey-buddies-t643)    [Archive](https://getgrav.org/forum/archive) · by Muut Archive, 9 years ago |  | 2 | 1870 | [9 years ago](https://getgrav.org/forum/archive/hey-buddies-t643 "by Muut Archive") |
| [There is a way to do a "if condition" in MD page?](https://getgrav.org/forum/archive/there-is-a-way-to-do-a-if-condition-in-md-page-t3377)    [Archive](https://getgrav.org/forum/archive) · by Muut Archive, 9 years ago |  | 2 | 5193 | [9 years ago](https://getgrav.org/forum/archive/there-is-a-way-to-do-a-if-condition-in-md-page-t3377 "by Muut Archive") |
| [Official docker image of grav (+admin +gitsync)](https://getgrav.org/forum/archive/official-docker-image-of-grav-admin-gitsync-t8519)    [Archive](https://getgrav.org/forum/archive) · by Muut Archive, 9 years ago |  | 1 | 4010 | [9 years ago](https://getgrav.org/forum/archive/official-docker-image-of-grav-admin-gitsync-t8519 "by Muut Archive") |
| [Weird Grav + caddy + iOS + https problem](https://getgrav.org/forum/archive/weird-grav-caddy-ios-https-problem-t7837)    [Archive](https://getgrav.org/forum/archive) · by Muut Archive, 9 years ago |  | 3 | 1958 | [9 years ago](https://getgrav.org/forum/archive/weird-grav-caddy-ios-https-problem-t7837 "by Muut Archive") |
