From 36cd0a16eb6213c41a014c47131185f45c721c26 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Tue, 28 Nov 2023 07:51:01 +0100 Subject: [PATCH] Remove .envrc and show an example in .envrc.sample The .envrc file is used by direnv to load the environment variables and having this file in the repository can cause problems when the user has already one in his home directory. Moreover this file automatically loads silently the environment variables from .env.sample bypassing the explicit "direnv allow" that usually needed with .envrc which can be a potential security issue. This is still a useful file and to know about for contributors so we keep the sample file in .envrc.sample and let user copy it to .envrc if they want to use it. Signed-off-by: Chmouel Boudjnah --- .env.sample | 4 ---- .envrc | 18 ------------------ .envrc.sample | 7 +++++++ 3 files changed, 7 insertions(+), 22 deletions(-) delete mode 100644 .env.sample delete mode 100644 .envrc create mode 100644 .envrc.sample diff --git a/.env.sample b/.env.sample deleted file mode 100644 index 9d2db2f3453..00000000000 --- a/.env.sample +++ /dev/null @@ -1,4 +0,0 @@ -# shellcheck shell=bash -# This is an example of a .env file -export GOMAXPROCS=6 -export KO_DOCKER_REPO=gcr.io/tektoncd/pipeline diff --git a/.envrc b/.envrc deleted file mode 100644 index 57593a21e40..00000000000 --- a/.envrc +++ /dev/null @@ -1,18 +0,0 @@ -# shellcheck shell=bash - -# If .env missing; restore from .env.sample and validate -# See https://github.com/direnv/direnv/wiki/.envrc-Boilerplate -if [[ -f .env.sample ]]; then - if [[ ! -f .env ]]; then - if ! command -v createnv > /dev/null; then - echo 'WARN|Createnv missing; try: pyenv local 3.x && pip install createnv' - else - createnv --use-default --overwrite || echo 'ERROR|https://github.com/cuducos/createnv' - if command dotenv-linter --version >&/dev/null; then - dotenv-linter .env || echo 'ERROR|https://dotenv-linter.github.io' - fi - fi - fi -fi - -dotenv_if_exists || direnv status # https://direnv.net/man/direnv-stdlib.1.html diff --git a/.envrc.sample b/.envrc.sample new file mode 100644 index 00000000000..cea7a728f1b --- /dev/null +++ b/.envrc.sample @@ -0,0 +1,7 @@ +# shellcheck shell=bash +# This is an example of a .envrc file for use with direnv +# +# See https://direnv.net/#getting-started for more information on how to get +# started with direnv +export GOMAXPROCS=6 +export KO_DOCKER_REPO=gcr.io/tektoncd/pipeline