TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Sendenv, a CLI tool to share environment variables

83 pointsby aster0idover 1 year ago
My weekend project sendenv is a CLI tool that lets you share environment variables securely with someone else. It is built on top of magic-wormhole which allows for safe, account-free data transfer. When you send variables using sendenv, it creates a one-time code. You give this code to the person who needs the variables. They use the code in their shell to load the variables. This is handy for quickly setting up new team members or copying local environment variables to another system.<p>Its currently in alpha obviously, but the core functionality works (I have tested sending vaults from a Macbook Air M1 to a ubuntu ec2 instance). I have a lot of follow up ideas to make this better, but wanted the community&#x27;s feedback before I invest more time on this.<p>Thanks for reading!

5 comments

TheDongover 1 year ago
Before sendenv, but with magicwormhole (which it&#x27;s built on top of):<p><pre><code> machine1 $ export var1=hello machine1 $ export -p var1 | wormhole send --text - On the other computer, please run wormhole receive 1-word-word machine2 $ eval &quot;$(wormhole receive 1-word-word)&quot; machine2 $ echo $var1 hello </code></pre> After sendenv:<p><pre><code> machine1 $ export var1=hello machine1 $ sendenv create-vault v machine1 $ sendenv add-var v machine1 $ sendenv send-vault v machine2 $ sendenv receive-vault Please logout and login again for the changes to take effect machine2 $ echo $var1 # doesn&#x27;t work, needed to re-login </code></pre> sendenv also writes to &quot;~&#x2F;.bash_profile&quot;, &quot;~&#x2F;.zshrc&quot;, which is fraught (i.e. on my system they&#x27;re read-only files).<p>It also, just like the eval in the first example, has the downside of requiring you to completely trust the sender since they can send arbitrary code to execute that&#x27;ll get written to your shell&#x27;s rc file.<p>Basically, if you need to share ad-hoc env vars in a single terminal session, the wormhole snippet I posted above is fine.<p>If you want them to persist, probably use direnv to share them, ideally tracked in version control.<p>If you want them to persist system-wide, use ansible or some other configuration management.<p>The middle-ground, of wanting them to persist so much you write them to the shell rc, but not wanting them to be version controlled or configuration managed, seems like the worst of both worlds.
评论 #39099412 未加载
评论 #39105265 未加载
评论 #39099560 未加载
wanderingstanover 1 year ago
Related tool: a friend and I created `diffenv` for developers to easily compare (diff) development environments including environment variables:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;error-central&#x2F;diffenv">https:&#x2F;&#x2F;github.com&#x2F;error-central&#x2F;diffenv</a><p>Helps for debugging those times when you say, “well it runs fine on my machine, what’s different about your machine??”
评论 #39102690 未加载
kamma4434over 1 year ago
Not sure I’d use this. Might be fun to develop, but what’s wrong with a text file you copy to your bashrc or whatever?
评论 #39102729 未加载
anilakarover 1 year ago
Ansible vault, anyone?
评论 #39102766 未加载
seangirardover 1 year ago
Cool idea!
评论 #39099336 未加载