BitlyTwiser / apprunner

Run apps from yaml config
6 stars 0 forks source link

Add optional .env loading into Tmux session(s) #1

Closed BitlyTwiser closed 1 month ago

BitlyTwiser commented 1 month ago

I have had at least 1 human approach me and inquire upon optional loading of .env's into a given environment.

Reading through the Tmux documentation (by that, I mean the man page) the following text is stated to be possible:

If -E is used, the update-environment option will not be applied. -e takes the form ‘VARIABLE=value’ and sets an environment variable for the newly created session; it may be specified multiple times.

http://man.openbsd.org/OpenBSD-current/man1/tmux.1#GLOBAL_AND_SESSION_ENVIRONMENT

We are creating sessions as it is to inject your commands into, thus it should be rather possible to load an env.

We have the project Zdotenv which exposes the parser for loading a .env (instead of loading the .env directly into the std.process.EnvMap.

Project: https://github.com/BitlyTwiser/zdotenv

Import the parser and utilize this to parse and inject the .env values into the tmux session.

BitlyTwiser commented 1 month ago

Close with release: https://github.com/BitlyTwiser/apprunner/actions/runs/11296895759