Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Centralized backup of .env files (envkeeper) #252

Open
EnigmaCurry opened this issue Jul 2, 2024 · 1 comment
Open

Centralized backup of .env files (envkeeper) #252

EnigmaCurry opened this issue Jul 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@EnigmaCurry
Copy link
Owner

EnigmaCurry commented Jul 2, 2024

Create an etckeeper like helper program that d.rymcg.tech can use to manage the backup of .env files.

BACKUP_DIR=~/git/$(hostname)-env-backup
[email protected]:whomever/whatever.git
ROOT_DIR=~/git/vendor/enigmacurry/d.rymcg.tech

# Set ENVKEEPER_HOME so it knows where the backup is.
$ export ENVKEEPER_HOME=${BACKUP_DIR}

# Initialize the backup
$ envkeeper init ${BACKUP_DIR}

# Use embedded git to add a remote (or run any git command):
$ envkeeper git remote add origin ${BACKUP_REMOTE}

# Only have to add files once to track them forever:
$ envkeeper add ${ROOT_DIR}/whoami/.env_test-default

# Add arbitrary metadata to the next commit (ie JSON or whatever) :
$ envkeeper meta '{"d.rymcg.tech": { "git": { "head": "XXXX" } }}'

# Commit will git add, and commit all changes to all previously added .env files.
$ envkeeper commit "Making a commit to env keeper repo"

# Push changes
$ envkeeper push

Create new variables in the root d.ry .env file:

  • ENVKEEPER_ENABLED true or false to enable envkeeper for this context.
  • ENVKEEPER_HOME path to the backup directory.

Create a hook for make install so that it calls envkeeper add, envkeeper commit, and envkeeper push automatically, but only if ENVKEEPER_ENABLED is true.

@EnigmaCurry EnigmaCurry added the enhancement New feature or request label Jul 2, 2024
@EnigmaCurry
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant