mirror of
https://github.com/sbrow/envr.git
synced 2025-12-29 15:47:38 -05:00
docs: Added docs.
This commit is contained in:
130
README.md
130
README.md
@@ -3,7 +3,7 @@
|
||||
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 binary applicate that tracks your `.env` files
|
||||
`envr` is a binary application that tracks your `.env` files
|
||||
in an encyrpted sqlite database. Changes can be effortlessly synced with
|
||||
`envr sync`, and restored with `envr restore`.
|
||||
|
||||
@@ -18,59 +18,57 @@ the tool [of your choosing](#backup-options).
|
||||
be run on a cron.
|
||||
- 🔍 **Smart Scanning**: Automatically discover and import `.env` files 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](https://www.nushell.sh/)
|
||||
- ✨ **Interactive CLI**: User-friendly prompts for file selection and management.
|
||||
|
||||
## TODOS
|
||||
|
||||
- [ ] Allow configuration of ssh key.
|
||||
- [ ] Allow multiple ssh keys.
|
||||
- [ ] 🗂️ **Rename Detection**: Automatically handle renamed repositories.
|
||||
- [ ] Allow use of keys from `ssh-agent`
|
||||
- [x] Allow configuration of ssh key.
|
||||
- [x] Allow multiple ssh keys.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- An SSH key pair (for encryption/decryption)
|
||||
- The following binaries:
|
||||
- [nushell](https://www.nushell.sh/)
|
||||
- [age](https://github.com/FiloSottile/age)
|
||||
- [fd](https://github.com/sharkdp/fd)
|
||||
- [sqlite3](https://github.com/sqlite/sqlite)
|
||||
- [git](https://git-scm.com)
|
||||
|
||||
## Installation
|
||||
|
||||
1. Clone the repository:
|
||||
```bash
|
||||
git clone https://github.com/username/envr.git
|
||||
cd envr
|
||||
```
|
||||
2. Install [dependencies](#prerequisites).
|
||||
3. Configure nushell.
|
||||
### With Go
|
||||
|
||||
If you already have `go` installed:
|
||||
|
||||
```bash
|
||||
go install github.com/sbrow/envr
|
||||
envr init
|
||||
```
|
||||
|
||||
### With Nix
|
||||
|
||||
If you are a [nix](https://nixos.org/) user
|
||||
|
||||
#### Try it out
|
||||
|
||||
```bash
|
||||
nix run github.com:sbrow/envr --
|
||||
```
|
||||
|
||||
#### Install it
|
||||
|
||||
```nix
|
||||
# /etc/nixos/configuration.nix
|
||||
{ config, envr, system, ... }: {
|
||||
environment.systemPackages = [
|
||||
envr.packages.${system}.default
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. **Initialize envr**:
|
||||
```bash
|
||||
envr init
|
||||
```
|
||||
This will create your configuration file and set up encrypted storage.
|
||||
|
||||
2. **Scan for existing .env files**:
|
||||
```bash
|
||||
envr scan
|
||||
```
|
||||
Select files you want to back up from the interactive list.
|
||||
|
||||
3. **List tracked files**:
|
||||
```bash
|
||||
envr list
|
||||
```
|
||||
|
||||
4. **Sync your environment files**:
|
||||
```bash
|
||||
envr sync
|
||||
```
|
||||
Check out the [man page](./docs/cli/envr.md) for the quick setup guide.
|
||||
|
||||
## Disclaimers
|
||||
|
||||
@@ -79,44 +77,52 @@ thanks to [nushell](https://www.nushell.sh/)
|
||||
|
||||
## 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 |
|
||||
See [the docs](./docs/cli) for the current list of available commands.
|
||||
|
||||
## Configuration
|
||||
|
||||
The configuration file is created during initialization and supports multiple formats:
|
||||
The configuration file is created during initialization:
|
||||
|
||||
```toml
|
||||
# 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 = "~"
|
||||
```jsonc
|
||||
# Example ~/.envr/config.json
|
||||
{
|
||||
"keys": [
|
||||
{
|
||||
"private": "/home/spencer/.ssh/id_ed25519",
|
||||
"public": "/home/spencer/.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*
|
||||
back up the database (found at `~/.envr/data.age`) to a *secure* and *remote*
|
||||
location.
|
||||
|
||||
### Git
|
||||
|
||||
`envr` preserves inodes when updating the database, so you can safely hardlink
|
||||
`~/.envr/data.age` into your [GNU Stow](https://www.gnu.org/software/stow/),
|
||||
[Home Manager](https://github.com/nix-community/home-manager), or
|
||||
[NixOS](https://nixos.wiki/wiki/flakes) repository.
|
||||
|
||||
> [!CAUTION]
|
||||
> For **maximum security**, only save your `data.age` file to a local
|
||||
(i.e. non-cloud) git server that **you personally control**.
|
||||
>
|
||||
> I take no responsibility if you push all your secrets to a public GitHub repo.
|
||||
|
||||
### restic
|
||||
|
||||
[restic](https://restic.readthedocs.io/en/latest/010_introduction.html).
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the [MIT License](./LICENSE).
|
||||
|
||||
Reference in New Issue
Block a user