Skip to content

Commit

Permalink
Fix link and add env var naming example
Browse files Browse the repository at this point in the history
  • Loading branch information
VioletM committed Aug 28, 2024
1 parent 63f8954 commit 3b67a6c
Showing 1 changed file with 61 additions and 5 deletions.
66 changes: 61 additions & 5 deletions docs/website/docs/general-usage/credentials/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ keywords: [credentials, secrets.toml, secrets, config, configuration, environmen
variables, provider]
---

`dlt` automatically extracts configuration settings and secrets based on flexible [naming conventions](setup/#naming-convention).
`dlt` automatically extracts configuration settings and secrets based on flexible [naming conventions](#naming-convention).

It then [injects](advanced/#injection-mechanism) these values where needed in functions decorated with `@dlt.source`, `@dlt.resource`, or `@dlt.destination`.

Expand Down Expand Up @@ -39,15 +39,71 @@ Please make sure your pipeline name contains no whitespace or any other punctuat

To keep the naming convention flexible, `dlt` looks for a lot of possible combinations of key names, starting from the most specific possible path. Then, if the value is not found, it removes the right-most section and tries again.

* The most specific possible path for **sources** looks like:
The most specific possible path for **sources** looks like:

<Tabs
groupId="config-provider-type"
defaultValue="toml"
values={[
{"label": "Toml config provider", "value": "toml"},
{"label": "ENV variables", "value": "env"},
{"label": "In the code", "value": "code"},
]}>
<TabItem value="toml">

```sh
[<pipeline_name>.sources.<source_module_name>.<source_function_name>]
<argument_name>="some_value"
```
</TabItem>
<TabItem value="env">

```sh
export PIPELINE_NAME__SOURCES__SOURCE_MODULE_NAME__SOURCE_FUNCTION_NAME__ARGUMENT_NAME="some_value"
```
</TabItem>
<TabItem value="code">

```py
import os

os.environ["PIPELINE_NAME__SOURCES__SOURCE_MODULE_NAME__SOURCE_FUNCTION_NAME__ARGUMENT_NAME"] = "some_value"
```
</TabItem>
</Tabs>

The most specific possible path for **destinations** looks like:

<Tabs
groupId="config-provider-type"
defaultValue="toml"
values={[
{"label": "Toml config provider", "value": "toml"},
{"label": "ENV variables", "value": "env"},
{"label": "In the code", "value": "code"},
]}>
<TabItem value="toml">

```sh
<pipeline_name>.sources.<source_module_name>.<source_function_name>.<argument_name>
[<pipeline_name>.destination.<destination name>.credentials]
<credential_option>="some_value"
```
</TabItem>
<TabItem value="env">

* The most specific possible path for **destinations** looks like:
```sh
<pipeline_name>.destination.<destination name>.credentials.<credential_option>
export PIPELINE_NAME__DESTINATION__DESTINATION_NAME__CREDENTIALS__CREDENTIAL_VALUE="some_value"
```
</TabItem>
<TabItem value="code">

```py
import os

os.environ["PIPELINE_NAME__DESTINATION__DESTINATION_NAME__CREDENTIALS__CREDENTIAL_VALUE"] = "some_value"
```
</TabItem>
</Tabs>

### Example

Expand Down

0 comments on commit 3b67a6c

Please sign in to comment.