From 2b81b8503169b0ff93df52ce9d345ad12e01aeaa Mon Sep 17 00:00:00 2001 From: Drinks Date: Thu, 15 Apr 2021 10:51:48 -0400 Subject: [PATCH] Allow opt-out of dotfile sourcing (#275) * allow opt-out of dotfile sourcing * update README with examples of suppressing environment files --- README.md | 10 +++++++++- dev/app.go | 10 +++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 09199c3..be8fe3d 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,15 @@ Puma-dev supports loading environment variables before puma starts. It checks fo * `.powenv` * `.pumaenv` -Additionally, puma-dev uses a few environment variables to control how puma is started that you can overwrite in your loaded shell config. +You can prevent puma-dev from loading any of these environment files by setting a corresponding environment variable to '0': + +* `PUMADEV_SOURCE_POWCONFIG=0` +* `PUMADEV_SOURCE_ENV=0` +* `PUMADEV_SOURCE_POWRC=0` +* `PUMADEV_SOURCE_POWENV=0` +* `PUMADEV_SOURCE_PUMAENV=0` + +Additionally, puma-dev uses a few other environment variables to control how puma is started that you can overwrite in your loaded shell config. * `CONFIG`: A puma configuration file to load, usually something like `config/puma-dev.rb`. Defaults to no config. * `THREADS`: How many threads puma should use concurrently. Defaults to 5. diff --git a/dev/app.go b/dev/app.go index 8cae101..a29f962 100644 --- a/dev/app.go +++ b/dev/app.go @@ -236,23 +236,23 @@ func (a *App) Log() string { const executionShell = `exec bash -c ' cd %s -if test -e ~/.powconfig; then +if test -e ~/.powconfig && [ "$PUMADEV_SOURCE_POWCONFIG" != "0" ]; then source ~/.powconfig fi -if test -e .env; then +if test -e .env && [ "$PUMADEV_SOURCE_ENV" != "0" ]; then source .env fi -if test -e .powrc; then +if test -e .powrc && [ "$PUMADEV_SOURCE_POWRC" != "0" ]; then source .powrc fi -if test -e .powenv; then +if test -e .powenv && [ "$PUMADEV_SOURCE_POWENV" != "0" ]; then source .powenv fi -if test -e .pumaenv; then +if test -e .pumaenv && [ "$PUMADEV_SOURCE_PUMAENV" != "0" ]; then source .pumaenv fi