From 47cd361663026380468696f50b69c9529168dc4e Mon Sep 17 00:00:00 2001 From: Daya Adianto Date: Tue, 24 Dec 2024 14:14:13 +0700 Subject: [PATCH 1/4] docs: Mention about the use of Dynaconf (#1398) --- docs/docs/installation/locally.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/installation/locally.md b/docs/docs/installation/locally.md index 2d9859bf2..b13984e27 100644 --- a/docs/docs/installation/locally.md +++ b/docs/docs/installation/locally.md @@ -66,7 +66,7 @@ To invoke a tool (for example `review`), you can run directly from the Docker im docker run --rm -it -e CONFIG.GIT_PROVIDER=bitbucket -e OPENAI.KEY=$OPENAI_API_KEY -e BITBUCKET.BEARER_TOKEN=$BITBUCKET_BEARER_TOKEN codiumai/pr-agent:latest --pr_url= review ``` -For other git providers, update CONFIG.GIT_PROVIDER accordingly, and check the `pr_agent/settings/.secrets_template.toml` file for the environment variables expected names and values. +For other git providers, update CONFIG.GIT_PROVIDER accordingly, and check the `pr_agent/settings/.secrets_template.toml` file for the environment variables expected names and values. The `pr_agent` uses [Dynaconf](https://www.dynaconf.com/) to load the settings from the configuration files. It is also possible to provide or override the configuration by setting the corresponding environment variables. --- From a5c5e6f4aeb35534b142a3bf73624347d07cdd6e Mon Sep 17 00:00:00 2001 From: Daya Adianto Date: Tue, 24 Dec 2024 14:44:45 +0700 Subject: [PATCH 2/4] docs: Add example how to define environment variables (#1398) --- docs/docs/installation/locally.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/docs/docs/installation/locally.md b/docs/docs/installation/locally.md index b13984e27..d4178709b 100644 --- a/docs/docs/installation/locally.md +++ b/docs/docs/installation/locally.md @@ -66,7 +66,28 @@ To invoke a tool (for example `review`), you can run directly from the Docker im docker run --rm -it -e CONFIG.GIT_PROVIDER=bitbucket -e OPENAI.KEY=$OPENAI_API_KEY -e BITBUCKET.BEARER_TOKEN=$BITBUCKET_BEARER_TOKEN codiumai/pr-agent:latest --pr_url= review ``` -For other git providers, update CONFIG.GIT_PROVIDER accordingly, and check the `pr_agent/settings/.secrets_template.toml` file for the environment variables expected names and values. The `pr_agent` uses [Dynaconf](https://www.dynaconf.com/) to load the settings from the configuration files. It is also possible to provide or override the configuration by setting the corresponding environment variables. +For other git providers, update `CONFIG.GIT_PROVIDER` accordingly and check the `pr_agent/settings/.secrets_template.toml` file for environment variables expected names and values. +The `pr_agent` uses [Dynaconf](https://www.dynaconf.com/) to load settings from configuration files. + +It is also possible to provide or override the configuration by setting the corresponding environment variables. +You can define the corresponding environment variables by following this convention: `__=` or `
.=`. +The `
` refers to a table/section in a configuration file and `=` refers to the key/value pair of a setting in the configuration file. + +For example, suppose you want to run `pr_agent` that connects to a self-hosted GitLab instance similar to an example above. +You can define the environment variables in a plain text file named `.env` with the following content: + +``` +CONFIG__GIT_PROVIDER="gitlab" +GITLAB__URL="" +GITLAB__PERSONAL_ACCESS_TOKEN="" +OPENAI__KEY="" +``` + +Then, you can run `pr_agent` using Docker with the following command: + +```shell +docker run --rm -it --env-file .env codiumai/pr-agent:latest +``` --- From b88507aa23c930407cb636ee2399c8136363e5ac Mon Sep 17 00:00:00 2001 From: Daya Adianto Date: Tue, 24 Dec 2024 15:14:30 +0700 Subject: [PATCH 3/4] chore: Ignore .env file --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ec1de25f4..1d4841e44 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .idea/ .lsp/ .vscode/ +.env venv/ pr_agent/settings/.secrets.toml __pycache__ @@ -8,4 +9,4 @@ dist/ *.egg-info/ build/ .DS_Store -docs/.cache/ +docs/.cache/ \ No newline at end of file From 11676943b631ef7e891bca00f40c9d176cfc2304 Mon Sep 17 00:00:00 2001 From: Daya Adianto Date: Tue, 24 Dec 2024 15:20:15 +0700 Subject: [PATCH 4/4] docs: Remind user to avoid commiting .env file (#1398) --- docs/docs/installation/locally.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/docs/installation/locally.md b/docs/docs/installation/locally.md index d4178709b..8ed53c4ce 100644 --- a/docs/docs/installation/locally.md +++ b/docs/docs/installation/locally.md @@ -76,6 +76,8 @@ The `
` refers to a table/section in a configuration file and `= Warning: Never commit the `.env` file to version control system as it might contains sensitive credentials! + ``` CONFIG__GIT_PROVIDER="gitlab" GITLAB__URL=""