switchenv | line tool for loading different bash environment profiles

 by   robdmc Python Version: 0.3.0 License: MIT

kandi X-RAY | switchenv Summary

kandi X-RAY | switchenv Summary

switchenv is a Python library. switchenv has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can install using 'pip install switchenv' or download it from GitHub, PyPI.

In my analysis work, I will frequently put auth credentials into environment variables. This allows me to check my code into Github without divulging any secrets. So, for example, I might have code in a Jupyter notebook that looks something like. The database I connect to will be completely determined by the environment variables I have defined. switchenv gives me a way to easily navigate between different environments so that, for example, I can quickly switch between development and production databases.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              switchenv has a low active ecosystem.
              It has 43 star(s) with 3 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 0 open issues and 5 have been closed. On average issues are closed in 17 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of switchenv is 0.3.0

            kandi-Quality Quality

              switchenv has 0 bugs and 0 code smells.

            kandi-Security Security

              switchenv has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              switchenv code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              switchenv is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              switchenv releases are not available. You will need to build from source code and install.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              switchenv saves you 212 person hours of effort in developing the same functionality from scratch.
              It has 520 lines of code, 46 functions and 8 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed switchenv and discovered the below as its top functions. This is intended to give you an instant insight into switchenv implemented functionality, and help decide if they suit your requirements.
            • Delete profiles
            • Save a blob to disk
            • Confirm the contents of the given file
            • Delete one or more profiles
            • Execute a shell command
            • Get code for a profile
            • Checks if the given profiles exist
            • Get code list for a profile
            • Show available profiles
            • Show a single key
            • Shows the current profile
            • Set the configuration directory
            • Change blob location
            • Compose profiles
            • Update a composed profile
            • Add code to switch
            • Update a raw code
            • Load the content of the file
            • Load a file
            • List available profiles
            • Snapshot a profile
            • Get the version string
            • Run switch env
            Get all kandi verified functions for this library.

            switchenv Key Features

            No Key Features are available at this moment for switchenv.

            switchenv Examples and Code Snippets

            Setting up ,Basic Setup
            Pythondot img1Lines of Code : 31dot img1License : Permissive (MIT)
            copy iconCopy
            bash>
            bash> # Make sure I'm in a directory with the rc files I want
            bash> ls *.sh
            rc_development_db.sh  rc_production_db.sh  rc_bash_functions.sh
            bash>
            bash> # Load my rc scripts into switchenv giving them profile names
            bash> switch  
            Navigating Between Environments with
            Pythondot img2Lines of Code : 23dot img2License : Permissive (MIT)
            copy iconCopy
            switchenv --help
            
            bash> sw --help
            
            Usage: sw [OPTIONS] COMMAND [ARGS]...
            
            Options:
              --help  Show this message and exit.
            
            Commands:
              add            Create a profile from file
              compose        Compose a new profile from existing profiles
              config   
            Use Case
            Pythondot img3Lines of Code : 16dot img3License : Permissive (MIT)
            copy iconCopy
            export MY_MESSAGE="You are in dev profile"
            export PGPORT=5432
            export PGPASSWORD=my_dev_password
            export PGUSER=my_dev_username
            export PGDATABASE=my_dev_database
            export PGHOST=my_dev_host
            
            export MY_MESSAGE="You are in prod profile"
            export PGPORT=5432
              

            Community Discussions

            QUESTION

            Expanding string variables in bash to toggle a value in JSON
            Asked 2017-Aug-07 at 21:58

            I am trying to create a bash function where I can switch environments, below is what I tried. I installed the npm json package globally to edit the relevant file inline, but that may not be needed.

            ...

            ANSWER

            Answered 2017-Aug-07 at 21:45

            The below is a sample implementation that does what you're looking for; see the notes below for some details on why it was implemented as it was.

            Source https://stackoverflow.com/questions/45555880

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install switchenv

            switchenv is written in python. You can install it with.
            Below is copy-paste from an interactive bash session showing how to set up the switchenv workflow. Under the hood, switchenv placed a json file in a hidden directory off of my home directory. This json file serves as the centralized data-store for all of my profile information.
            I can also create composed profiles. These profiles will source other named profiles in the order they are specified. Any changes I make to one of the sourced profiles will automatically carry over to the composite profile. Composed profiles can be nested. So, a composed profile can have another composed profile as one of its sub-profiles. Here is an example of setting up a composed profile. Now when you list profiles, you can easily identify composed profiles and see the order in which they will execute their sub-profiles.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install switchenv

          • CLONE
          • HTTPS

            https://github.com/robdmc/switchenv.git

          • CLI

            gh repo clone robdmc/switchenv

          • sshUrl

            git@github.com:robdmc/switchenv.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link