Skip to content

Commit

Permalink
docs: copyyedit docs/dev/how-to-use-direnv.md (#10002)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauamma committed Mar 24, 2024
1 parent 8a8d842 commit 39c12fe
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docs/dev/how-to-use-direnv.md
@@ -1,28 +1,29 @@
# How to use direnv

As a developer, it can be better not to think too much about setting right env variables as you enter a project.
As a developer, it can be better not to think too much about setting the right env variables as you enter a project.
[`direnv`](https://direnv.net/) aims at providing a solution.

As a quick guide as an openfoodfacts developer:

- install direnv on your system using usual package manager
- install direnv on your system using the usual package manager
- in your .bashrc add:
```bash
# direnv
eval "$(direnv hook bash)"
```
you have adapt the direnv line according to what you use, see [direnv doc](https://direnv.net/docs/hook.html)
- In your project directory add a file, where you superseed variables from `.env`
that you wan't to
You have to adapt the direnv line according to what you use; see [direnv doc](https://direnv.net/docs/hook.html).
- in your project directory add a file, where you override variables from `.env`
that you want to:

```
echo "setting up docker compose env"
export DOCKER_BUILDKIT=1
# The next two lines do the same thing in different ways; choose one.
export USER_UID=${UID}
export USER_UID=$(id -g)
```

- in project directory, run `direnv allow .`
- in your project directory, run `direnv allow .`
- in a new shell:
- go in project directory
- you should have direnv trigger and load your variables
- go to the project directory
- direnv should trigger and load your variables

0 comments on commit 39c12fe

Please sign in to comment.