Skip to content

Instantly share code, notes, and snippets.

@kris-luminar
Forked from esundahl/env.json
Created March 23, 2012 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kris-luminar/2175030 to your computer and use it in GitHub Desktop.
Save kris-luminar/2175030 to your computer and use it in GitHub Desktop.
toggle_dev_environment
var dev = "dev",
staging = "staging",
production = "production",
url = window.location,
hostname = window.location.hostname;
hostname = hostname.split('.');
if (hostname[1] === dev) {
hostname[1] = staging;
}
else if (hostname[1] === staging) {
hostname[1] = production;
}
else {
hostname[1] = dev;
};
window.location.hostname = hostname.join('.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment