envr - Backup your env files
Have you ever wanted to back up all your .env files in case your hard drive gets
nuked? envr makes it easier.
envr is a Nushell script that tracks your .env files
in an encyrpted sqlite database. Changes can be effortlessly synced with
envr sync, and restored with envr restore.
envr puts all your .env files in one safe place, so you can back them up with
the tool of your choosing.
Features
- 🔐 Encrypted Storage: All
.envfiles are encrypted using your ssh key and age encryption. - 🔄 Automatic Sync: Update the database with one command, which can easily be run on a cron.
- 🔍 Smart Scanning: Automatically discover and import
.envfiles in your home directory. - 📝 Multiple Config Formats: Support for many configuration formats, including: JSON, TOML, YAML, INI, XML, and NUON.
- TODO: 🗂️ Rename Detection: Automatically handle renamed repositories.
- ✨ Interactive CLI: User-friendly prompts for file selection and management thanks to nushell
TODOS
- Allow configuration of ssh key.
- Allow multiple ssh keys.
Prerequisites
Installation
- Clone the repository:
git clone https://github.com/username/envr.git cd envr - Install dependencies.
- Configure nushell.
Quick Start
-
Initialize envr:
nu mod.nu envr initThis will create your configuration file and set up encrypted storage.
-
Scan for existing .env files:
nu mod.nu envr scanSelect files you want to back up from the interactive list.
-
List tracked files:
nu mod.nu envr list -
Sync your environment files:
nu mod.nu envr sync
Disclaimers
Caution
Do not lose your SSH key pair! Your backup will be lost forever.
Commands
| Command | Description |
|---|---|
envr init [format] |
Initialize envr with configuration file |
envr backup <file> |
Back up a specific .env file |
envr restore [path] |
Restore a backed-up .env file |
envr list |
View all tracked environment files |
envr scan |
Search for and selectively back up .env files |
envr sync |
Synchronize all tracked files (backup changes, restore missing) |
envr remove [...paths] |
Remove files from backup storage |
envr edit config |
Edit your configuration file |
envr config show |
Display current configuration |
Configuration
The configuration file is created during initialization and supports multiple formats:
# Example ~/.envr/config.toml
source = "~/.envr/config.toml"
priv_key = "~/.ssh/id_ed25519"
pub_key = "~/.ssh/id_ed25519.pub"
[scan]
matcher = "\.env"
exclude = "*.envrc"
include = "~"
Backup Options
envr merely gathers your .env files in one local place. It is up to you to
back up the database (found at ~/.envr/data.age) to a secure and remote
location.
Git
restic
License
This project is licensed under the MIT License.
Support
For issues, feature requests, or questions, please open an issue.