Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: copyyedit docs/dev/how-to-use-direnv.md (#10002)
- Loading branch information
Showing
1 changed file
with
9 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |