Skip to content

A terminal UI to manage .env files across multiple projects. Stop opening 12 editors to change one API key. Built with Python + Textual.

License

Notifications You must be signed in to change notification settings

FyefoxxM/environment-variable-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Environment Variable Manager

Day 3 of 30 for 30

Manage .env files across multiple projects from a single terminal UI. No more opening 12 editors to change one API key.

The Problem

You have multiple projects with different .env files. You're constantly:

  • Opening VSCode just to change one value
  • Forgetting which project uses which API key
  • Copy-pasting values between projects
  • Searching for that one .env file

This tool solves that.

Installation

pip install textual

Or use requirements.txt:

pip install -r requirements.txt

Usage

Scan current directory:

python envman.py

Scan specific directory:

python envman.py /path/to/projects

Features

  • Scans recursively - Finds all .env files up to 3 levels deep
  • List all files - See all your .env files in one place
  • View variables - See all key-value pairs for each file
  • Edit in place - Change values with a simple terminal UI
  • Add new variables - Add variables without opening an editor
  • Auto-saves - Changes are written back to the file immediately

How It Works

  1. Press 1-9 to edit a specific .env file
  2. Edit values directly in the input fields
  3. Press "Save" to write changes back
  4. Press "Add Variable" to add new ones
  5. Press Escape to go back
  6. Press q to quit

Limitations

  • Max 9 files displayed (who has more than 9 projects open anyway?)
  • No encryption (store sensitive values elsewhere)
  • No git integration (that's scope creep)
  • Doesn't handle multi-line values (rare in .env files)

Lines of Code

~250 lines of Python (including comments and whitespace)

Time to Build

6 hours (including learning Textual's widget system)

What Broke

Bug #1: DataTable Drama Initially tried to use Textual's DataTable widget for displaying and editing variables. Spent 45 minutes reading docs before realizing DataTable doesn't support inline editing. You can select cells, but can't edit them directly. Switched to individual Input widgets and it worked immediately.

Bug #2: The 303 Line Problem First version was 303 lines. Over the 300 line limit by 3 lines. Had to strip out docstrings and merge some imports. Down to 297 lines. Rule is the rule.

Bug #3: Quote Handling Forgot that .env files often use quotes for values with spaces. First version stripped ALL quotes, which broke values like NAME="John Doe". Had to add logic to only remove matched quotes and preserve the spaces inside.

Bug #4: CSS Typo Hell Spent 20 minutes debugging why my CSS wasn't applying to the variable rows. Turns out I had class="var-row" in the widget but .variable-row in the CSS. Classic typo. Changed CSS to .var-row and boom, styled.

What I Learned:

  • Read the widget docs THOROUGHLY before committing to one
  • Test with real .env files that have edge cases
  • CSS typos are always the problem
  • 300 lines is tighter than you think

Why This Is Useful

Because opening your editor just to change DEBUG=True to DEBUG=False is ridiculous. Now you can manage all your environment variables from one place.

Perfect for:

  • Switching between dev/prod settings
  • Managing API keys across projects
  • Checking what variables each project uses
  • Quick edits without context switching

About

A terminal UI to manage .env files across multiple projects. Stop opening 12 editors to change one API key. Built with Python + Textual.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors