Skip to content

Manage env files (enhancement) #4

@eric-burel

Description

@eric-burel

Since you are interested in dotenv files, I have some pain points with .env that could be adressed by a CLI tool.

Namely, I need to switch easily between a laptop and a desktop. And I have an app to maintain that is structured as a monorepo, so 2 APIs, a result app, a Next.js app. Next.js itself also generates lots of .env files for configuration (.env, .env.local, .env.development, .env.test...).

Keeping .env in sync is a pain. So I wonder if it would be possible to add a command that ties a local .env file, to another folder on disk. Typically, I would have a ~/Dropbox/env_files folder, or at least a ~/.env_files in the home, with subfolders per project. You could set that up once modenv init-backup ~/Dropbox/env_files [project-name] (and the current folder could be used as the project name if no project-name is provided).

Then modenv save would copy my local .env towards the home folder, and modenv update could do the opposite, updating the current folder .env based on the home folder.

The underlying issue is that .env are strongly tied to living in a local folder, but are hidden files, which makes them untrackable but also hard to backup. This could extend to backing up to cloud services in the future, the idea is the same: easily get the latest .env, easily save the modification you've made, to the cloud or to a local home folder.

Maybe this exists already? Is that something you'd like to see added in "modenv"? I am learning Rust and I would really like to contribute to something actually useful in order to progress.

Related: https://github.com/dotenv-org/dotenv-vault
But I don't like those products that hosts secrets, I'd rather keep the secrets in my personal dropbox/gcloud instead of involving yet another service. I could even encrypt the file when storing it outside of the local folder.

Antoher alternative: https://www.doppler.com/ It seems to rely on injecting the environment variable (run a "doppler" command before running any other command) instead of .env files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions