33Have you ever wanted to back up all your .env files in case your hard drive gets
44nuked? ` envr ` makes it easier.
55
6- ` envr ` is a binary applicate that tracks your ` .env ` files
6+ ` envr ` is a binary application that tracks your ` .env ` files
77in an encyrpted sqlite database. Changes can be effortlessly synced with
88` envr sync ` , and restored with ` envr restore ` .
99
@@ -18,59 +18,57 @@ the tool [of your choosing](#backup-options).
1818be run on a cron.
1919- 🔍 ** Smart Scanning** : Automatically discover and import ` .env ` files in your
2020home directory.
21- - 📝 ** Multiple Config Formats** : Support for many configuration formats,
22- including: JSON, TOML, YAML, INI, XML, and NUON.
23- - [ ] TODO: 🗂️ ** Rename Detection** : Automatically handle renamed repositories.
24- - ✨ ** Interactive CLI** : User-friendly prompts for file selection and management
25- thanks to [ nushell] ( https://www.nushell.sh/ )
21+ - ✨ ** Interactive CLI** : User-friendly prompts for file selection and management.
2622
2723## TODOS
2824
29- - [ ] Allow configuration of ssh key.
30- - [ ] Allow multiple ssh keys.
25+ - [ ] 🗂️ ** Rename Detection** : Automatically handle renamed repositories.
26+ - [ ] Allow use of keys from ` ssh-agent `
27+ - [x] Allow configuration of ssh key.
28+ - [x] Allow multiple ssh keys.
3129
3230## Prerequisites
3331
3432- An SSH key pair (for encryption/decryption)
3533- The following binaries:
36- - [ nushell] ( https://www.nushell.sh/ )
37- - [ age] ( https://github.com/FiloSottile/age )
3834 - [ fd] ( https://github.com/sharkdp/fd )
39- - [ sqlite3 ] ( https://github .com/sqlite/sqlite )
35+ - [ git ] ( https://git-scm .com )
4036
4137## Installation
4238
43- 1 . Clone the repository:
44- ``` bash
45- git clone https://github.com/username/envr.git
46- cd envr
47- ```
48- 2 . Install [ dependencies] ( #prerequisites ) .
49- 3 . Configure nushell.
39+ ### With Go
5040
51- ## Quick Start
41+ If you already have ` go ` installed:
42+
43+ ``` bash
44+ go install github.com/sbrow/envr
45+ envr init
46+ ```
47+
48+ ### With Nix
49+
50+ If you are a [ nix] ( https://nixos.org/ ) user
51+
52+ #### Try it out
53+
54+ ``` bash
55+ nix run github.com:sbrow/envr --
56+ ```
5257
53- 1 . ** Initialize envr** :
54- ``` bash
55- envr init
56- ```
57- This will create your configuration file and set up encrypted storage.
58+ #### Install it
5859
59- 2 . ** Scan for existing .env files** :
60- ``` bash
61- envr scan
62- ```
63- Select files you want to back up from the interactive list.
60+ ``` nix
61+ # /etc/nixos/configuration.nix
62+ { config, envr, system, ... }: {
63+ environment.systemPackages = [
64+ envr.packages.${system}.default
65+ ];
66+ }
67+ ```
6468
65- 3 . ** List tracked files** :
66- ``` bash
67- envr list
68- ```
69+ ## Quick Start
6970
70- 4 . ** Sync your environment files** :
71- ``` bash
72- envr sync
73- ```
71+ Check out the [ man page] ( ./docs/cli/envr.md ) for the quick setup guide.
7472
7573## Disclaimers
7674
@@ -79,44 +77,52 @@ thanks to [nushell](https://www.nushell.sh/)
7977
8078## Commands
8179
82- | Command | Description |
83- | ---------| -------------|
84- | ` envr init [format] ` | Initialize envr with configuration file |
85- | ` envr backup <file> ` | Back up a specific .env file |
86- | ` envr restore [path] ` | Restore a backed-up .env file |
87- | ` envr list ` | View all tracked environment files |
88- | ` envr scan ` | Search for and selectively back up .env files |
89- | ` envr sync ` | Synchronize all tracked files (backup changes, restore missing) |
90- | ` envr remove [...paths] ` | Remove files from backup storage |
91- | ` envr edit config ` | Edit your configuration file |
92- | ` envr config show ` | Display current configuration |
80+ See [ the docs] ( ./docs/cli ) for the current list of available commands.
9381
9482## Configuration
9583
96- The configuration file is created during initialization and supports multiple formats:
97-
98- ``` toml
99- # Example ~/.envr/config.toml
100- source = " ~/.envr/config.toml"
101- priv_key = " ~/.ssh/id_ed25519"
102- pub_key = " ~/.ssh/id_ed25519.pub"
103-
104- [scan ]
105- matcher = " \. env"
106- exclude = " *.envrc"
107- include = " ~"
84+ The configuration file is created during initialization:
85+
86+ ``` jsonc
87+ # Example ~ / . envr/ config .json
88+ {
89+ " keys" : [
90+ {
91+ " private" : " /home/spencer/.ssh/id_ed25519" ,
92+ " public" : " /home/spencer/.ssh/id_ed25519.pub"
93+ }
94+ ],
95+ " scan" : {
96+ " matcher" : " \\ .env" ,
97+ " exclude" : " *.envrc" ,
98+ " include" : " ~"
99+ }
100+ }
108101```
109102
110103## Backup Options
111104
112105` envr ` merely gathers your ` .env ` files in one local place. It is up to you to
113- back up the database (found at ~ /.envr/data.age) to a * secure* and * remote*
106+ back up the database (found at ` ~/.envr/data.age ` ) to a * secure* and * remote*
114107location.
115108
116109### Git
117110
111+ ` envr ` preserves inodes when updating the database, so you can safely hardlink
112+ ` ~/.envr/data.age ` into your [ GNU Stow] ( https://www.gnu.org/software/stow/ ) ,
113+ [ Home Manager] ( https://github.com/nix-community/home-manager ) , or
114+ [ NixOS] ( https://nixos.wiki/wiki/flakes ) repository.
115+
116+ > [ !CAUTION]
117+ > For ** maximum security** , only save your ` data.age ` file to a local
118+ (i.e. non-cloud) git server that ** you personally control** .
119+ >
120+ > I take no responsibility if you push all your secrets to a public GitHub repo.
121+
118122### restic
119123
124+ [ restic] ( https://restic.readthedocs.io/en/latest/010_introduction.html ) .
125+
120126## License
121127
122128This project is licensed under the [ MIT License] ( ./LICENSE ) .
0 commit comments