Skip to main content

switch between dev and prod environments from command line

Project description

switchto

switch between dev and prod environments from command line.

Installation

pip install switchto

How it works

It edits your hosts file locally on Windows, Linux and Mac.

Usage

Add entry

switchto -s my.website.com dev:127.0.0.1 team:192.168.1.100 prod:

This will create 3 entries for your website domain, named "dev", "team" and "prod". An empty string indicates to remove the entry from the hosts file once you run switchto that rule.

Switching from production to dev environment and back

switchto dev

Will add the following entry to your hosts:

127.0.0.1 my.website.com

Once you want to go back to production, you can:

switchto prod

Remove entries

You cannot remove entires from the config file, you can however set the rule to an empty string:

switchto -s my.website.com team:

Note: settings are saved in .s2.json on HOME or HOMEPATH directory.

Listing config

switchto -l

To list everything, or:

switchto -l regex

Which will list all rules matching that regex.

CNAMEs

Currently, switchto works only via hosts, which do not support redirecting domains to other domains, but only by IP address. You can create a rule with a target domain, but it will be resolved once you create the rule, and also you would have to pass "-y" to confirm this:

switchto -y -s my.website.com dev:my.website.local dev

Note the "dev" at the end, which specifies to make the switch instantly, rather than running "switchto dev" afterwards.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

switchto-0.0.2.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

switchto-0.0.2-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file switchto-0.0.2.tar.gz.

File metadata

  • Download URL: switchto-0.0.2.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.7

File hashes

Hashes for switchto-0.0.2.tar.gz
Algorithm Hash digest
SHA256 91ccec2beb4fafb9690f490426c87c997124a4971d60f3d88e5be6d655ebde0a
MD5 4203e40d1baa4fb261036038d7508e25
BLAKE2b-256 3b33c7c5f103fc1cd2d1e8745aa1a7771f158ab9c1492bf6def9eba3483511c4

See more details on using hashes here.

File details

Details for the file switchto-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: switchto-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.7

File hashes

Hashes for switchto-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 76bb76def9165d806ce2507e63bb6e9ef44e5cc1e0b5bf6a43fa7237135fb9f6
MD5 a8c7a7d721ed7f99303dd579ff5eb607
BLAKE2b-256 7c338d766c9f87f0230898597a086590dc4c6a99aaa339577df949489db87a4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page