When developing a real world application it is useful to incorporate the usage of environments. The concept of environments is common within rapid development as it allows you to control your code dependent on the current environment.
ajaxed currently supports two environments:
DEV
(default) and
LIVE
. You can set the environment in your
config.asp
using the
AJAXED_ENVIRONMENT
variable:
'live environment
AJAXED_ENVIRONMENT = "LIVE"
The
Library
class provides some properties for the environment setting:
<%
'gets the current environment
currentEnvironment = lib.env
'checks if it is development
isDevelopment = lib.dev
'checks if it is live (production)
isLive = lib.live
%>
With those properties you can easily control your code dependent to the configured environment. E.g. You could disable google analytics during the development process. Just chuck this snuippet into your
footer.asp
.
<% if lib.live then %>
<script>
//google analytics javascript
</script>
<% end if %>
Some interesting dependencies
- By defautl Emails are not dispatched on DEV
- The ajaxed console is blocked on LIVE
- Tests only run on DEV by default
- and more