News for hackers. Stuff that matters.
Re:Show HN: Shello – Wrangle Environment Variables by yayaj16 on Friday September 15, 2023 @04:32PM (#37528752)
Re:Show HN: Shello – Wrangle Environment Variables by pedalpete on Friday September 15, 2023 @06:58PM (#37530088)
I really wanted this to be a service that manages environment variables locally and in the cloud.

When we've set this up in the past, it was a bit of a pain to have local envs, and cloud envs, and the build system needs to get the cloud ones, etc. etc.

Re:Show HN: Shello – Wrangle Environment Variables by shayneo on Friday September 15, 2023 @07:47PM (#37530426)
You might be looking for something like https://www.doppler.com/

Though I could see adding “teams” features to shello that help with syncing and cloud environments

Re:Show HN: Shello – Wrangle Environment Variables by vmatsiiako on Friday September 15, 2023 @11:51PM (#37531896)
Check out Infisical (https://infisical.com)
Re:Show HN: Shello – Wrangle Environment Variables by mnahkies on Sunday September 17, 2023 @10:49AM (#37545599)
I've found this is largely solved by strictly separating plain config and secrets, and then having secrets pull from GCP secret manager / vault / whatever.

You can then commit all the config (including the secret identifiers) and it all just works so long as you're authenticated with your secret storage system.

We do this for the live configuration as well in line with Gitops and find it to work well.

If you don't want to use a cloud secret manager you can also use something like https://github.com/getsops/sops to commit the encrypted secrets safely

Re:Show HN: Shello – Wrangle Environment Variables by aradox66 on Sunday September 17, 2023 @11:42AM (#37546264)
This is the way
Re:Show HN: Shello – Wrangle Environment Variables by kazinator on Saturday September 16, 2023 @03:04AM (#37532633)
Single five-star review in Apple store by user "Codecious" 09/07/2023

> Well, Shello there ;)

> Why hasn't someone thought of this before? Once I added the bash shell function (see their website) it was super easy to swap between sets of envars. This will make life as a developer a bit more enjoyable :)"

Nope; totally not astroturfed by a sock puppet of the author!

Re:Show HN: Shello – Wrangle Environment Variables by kazinator on Saturday September 16, 2023 @10:57PM (#37541077)
I have no idea what the target audience is here?

The intersection of:

- People who understand environment variables in a shell environment and knows what it means to install a Bash function.

- People who have to swap environment variables in the same shell process for whatever weird reason.

- People who don't understand how to use the env utility to run a program in a precisely-determined environment containing only the environment variables they specify.

- People who think it's a good idea to get something from the Apple store to solve a shell programming problem.

Basically, empty set. I see zero PMF (product-market fit) here.

I find the following function amateurish; author should run it through shellcheck. What the funtion does would be completely unnecessary if the Shello GUI maintained the files in a format which the shell could just source; i.e. containing commands like "export var=value".

I won't remark on the shell coding details; the concept here is flawed. To switch from one environment to another, it is not enough to sweep through a file, read in some variables and export them. You also have to delete unwanted variables.

If we switch to environment A, and then B and then back to A, the result should be the same as if we only switched to A, and B never happened.

If we switch back to A, but the namespace is polluted by left-over variables from environment B, that's a fail.

  shello () {
    envFilePath="$HOME/Library/Containers/app.shello/Data/envs/$1"

    # Check if the file exists
    if [ -f "$envFilePath" ]; then
      # Read each line from the file and set environment variables
      while IFS= read -r line || [[ -n "$line" ]]; do
        # Split line into KEY and VALUE
        key=$(echo "$line" | cut -d '=' -f1)
        value=$(echo "$line" | cut -d '=' -f2-)

        # Set the environment variable
        export "$key"="$value"

        #  uncomment the line below if you want to print each key
        # echo "Setting $key from shello "
      done < "$envFilePath"

      export "SHELLO_CURRENT_ENV"="$1"
      echo " shello env --> $1"
    else
      echo "File not found: $envFilePath"
    fi
  }
Re:Show HN: Shello – Wrangle Environment Variables by kazinator on Sunday September 17, 2023 @10:50AM (#37545603)
This is some kind of GUI for editing files containing environment variables.

Instead of those files being stored in a shell script format that could simply be sourced, the author provides a badly written shell function to read those files one by one, parse the environment variables and export them. (I'm pasting it below so it is clear what I'm referring to in case it changes.)

The system is flawed because the shell function doesn't remove environment variables; it only adds them.

If we select environment set A, then B and then a A again, it is not the same as just selecting A, as it should be. The environment is polluted by left-over B variables.

In addition, the GUI program has a vanishingly small target audience, consisting possibly of just the author.

Out of the entire population working with shell scripts and environment variables, there has to be a subset which for whatever reason has to juggle among sets of environment variables, and in that subset, those have to be found who would would prefer a platform-specific GUI app from the Apple store to edit the environment variables rather than their favorite text editor.

  ## shello -- for managing environment variables
  shello () {
    envFilePath="$HOME/Library/Containers/app.shello/Data/envs/$1"

    # Check if the file exists
    if [ -f "$envFilePath" ]; then
      # Read each line from the file and set environment variables
      while IFS= read -r line || [[ -n "$line" ]]; do
        # Split line into KEY and VALUE
        key=$(echo "$line" | cut -d '=' -f1)
        value=$(echo "$line" | cut -d '=' -f2-)

        # Set the environment variable
        export "$key"="$value"

        #  uncomment the line below if you want to print each key
        # echo "Setting $key from shello "
      done < "$envFilePath"

      export "SHELLO_CURRENT_ENV"="$1"
      echo " shello env --> $1"
    else
      echo "File not found: $envFilePath"
    fi
  }