Skip to content

IamAbbey/py_sync_dotenv

Repository files navigation

Python Sync Dotenv ♻️

https://img.shields.io/pypi/pyversions/py-sync-dotenv?style=plastic:target:https://pypi.python.org/pypi/py-sync-dotenv

https://img.shields.io/travis/com/IamAbbey/py_sync_dotenv?style=plastic:target:https://travis-ci.com/github/IamAbbey/py_sync_dotenv

https://img.shields.io/readthedocs/py-sync-dotenv/latest?style=plastic:target:https://py-sync-dotenv.readthedocs.io/en/latest/:alt:DocumentationStatus

Python Sync Dotenv is a Python package for synchronizing .env files across projects using command-line interfaces.

Installation

$ pip install py-sync-dotenv

Usage

  • By default, py-sync-dotenv tries to locate the source .env file with the name .env from the current working directory.

    $ py-sync-dotenv
  • This behavior can be modified by providing the source .env file path using the -s, --source option.

    $ py-sync-dotenv -s .env.source
    
    #OR
    
    $ py-sync-dotenv --source .env.source
  • Another option that can be supplied is the -d, --destination-env which is used to provide the path to the destination .env file. The below commands synchronizes the source .env file with the specified destination env file - .env.dev

    $ py-sync-dotenv -d .env.dev
    
    #OR
    
    $ py-sync-dotenv --destination-env .env.dev``
  • Likewise, there is the -ds, --destination-envs option which is used to provide the directory containing the destination .env file(s). The below commands synchronizes the source .env file with all the .env files contained in the specified directory.

    $ py-sync-dotenv -ds dev_envs/
    
    #OR
    
    $ py-sync-dotenv --destination-envs dev_envs/``
  • Futhermore, to all the above options, you can specify the --just-variable flag to indicates to the engine to synchronize just the variables.

    $ py-sync-dotenv -d .env.dev --just-variables
    
    # Source --------------------> destination
    
    # SQL_HOST=127.0.0.1 --------> SQL_HOST=
    
    # SQL_PORT=5432 --------> SQL_PORT=

Command

  • The watch command can be used to auto synchronize the source .env file [on file changed/modified] with the specified destination file(s).

    $ py-sync-dotenv -s .env.source -d .env.dev watch
  • Coupled with the watch command is the --show-logs flag, which is used to show file changes logs as they occur.

    $ py-sync-dotenv -d .env.dev watch --show-logs

Options

Type Option Description
FILE -s, --source Source .env file to use in populating other .env files [default: .env].
FILE -d, --destination-env .env file for destination stage.
DIRECTORY -ds, --destination-envs Directory path to .env files for destination stage.

Flags

Type Flag Description
FLAG --just-variables indicates to the engine to synchronize just the variables.
FLAG --show-logs show file changes logs as they occur. To be used with the watch command
FLAG --help Show this message and exit.

Commands

Type Command Description
COMMAND watch indicates to the engine to auto synchronize the source .env file [on file changed/modified] with the specified destination file(s).

Credits

This package was created with Cookiecutter and the cookiecutter-pypackage project template.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published