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.3.tar.gz (3.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.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: switchto-0.0.3.tar.gz
  • Upload date:
  • Size: 3.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.3.tar.gz
Algorithm Hash digest
SHA256 fbbdd276e083635dff08c083b3dfe4aa24e66c4b47d79e6fba7523a06fa32a5c
MD5 6ee31a7d9536893a54ec126cb55cde84
BLAKE2b-256 8995c2172a6e22d8355232c19f71cc7d05203878a501b844f30001ae04fc42bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: switchto-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fec2f8295c1bb8be4d40351e319235e1e737522d026f7a2fea8bbad9666a1201
MD5 063568df94272999acf393cf870737fa
BLAKE2b-256 3a40b6948e1be5ec15d2167410efdd1317bd96a1c842ed36a5e75b8a81540845

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