Show HN: Shello – Wrangle environment variables(shello.app) A lightweight mac app for managing environment variables locally. No auth, no network requests, no usage tracking... just files on your machine. |
Show HN: Shello – Wrangle environment variables(shello.app) A lightweight mac app for managing environment variables locally. No auth, no network requests, no usage tracking... just files on your machine. |
> 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!
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
}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.
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
Though I could see adding “teams” features to shello that help with syncing and cloud environments