Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 871 Bytes

use-direnv.md

File metadata and controls

28 lines (23 loc) · 871 Bytes

Use direnv

As a developper, it can be better not to think too much about setting right env variables as you enter a project. direnv aims at providing a solution.

As a quick guide as an openfoodfacts developper:

  • install direnv on your system using usual package manager
  • in your .bashrc add:
    # direnv
    eval "$(direnv hook bash)"
    you have adapt the direnv line according to what you use, see direnv doc
  • In your project directory add a file, where you superseed variables from .env that you wan't to
echo "setting up docker-compose env"
export DOCKER_BUILDKIT=1
export USER_UID=${UID}
export USER_UID=$(id -g)
  • in project directory, run direnv allow .
  • in a new shell:
    • go in project directory
    • you should have direnv trigger and load your variables