-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple "environments" on the same machine? #4
Comments
Thanks for the detailed answer, Brian. I've added the conversion of our current switch block based on |
I'm responding to Gareth's questions via Twitter (here and here) in an issue because it's a little easier without a character limit and because I like having this discussion right here with the code and slides.
Quoting from above tweets:
Windows makes this a little harder than *nix does, since on linux, Mac, etc, you can run individual commands with a specific env var using this style:
This approach is a little harder in Windows. That said, the there are a couple things you can do here:
First, I'd recommend choosing one of the environments as "primary" (if that's applicable) and setting a machine-wide global command line environment variable for that. (The thinking here is that if you ever forget to manually set the environment, the "important" one should be in effect regardless. I like making it as hard as possible to "forget" something like this, although there are probably cases where "neither" is a better option but ask me about that separately.) Then you can use a batch script to override that environment var and put you in a CLI for the "other" environment. You'll have to use that script to set up the proper secondary environment, but that's kind of unavoidable when you have two envs on a single machine.
In this kind of situation, the most important goal (in my opinion) is to make as easy as possible to put yourself into each environment reliably and repeatably, so even if you end up just placing two shortcuts on your Desktop that open a command prompt, set the proper env var and
cd
to the proper webroot for you, that should get the job done. And really, this is actually pretty similar to the "shortcuts" you use to access the different environments on that machine from a browser (via different URLs).A third option would be to maintain two different login accounts for each environment, with per-user env vars set for each, but that's getting a little extreme and probably more complicated than it's worth.
Like I said: Just try to give yourself quick, reliable ways to get to each env. If anyone has better suggestions, I'm definitely all ears.
The text was updated successfully, but these errors were encountered: