Skip to content

Commit 584a57b

Browse files
authored
Fix code block formatting (#89)
1 parent 1cf2073 commit 584a57b

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

docs/index.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,15 +317,25 @@ Once you have your `.env` file filled with variables, *pydantic* supports loadin
317317
1. Setting the `env_file` (and `env_file_encoding` if you don't want the default encoding of your OS) on `model_config`
318318
in the `BaseSettings` class:
319319

320-
```py test="skip" lint="skip"
320+
```py hl_lines="4 5"
321+
from pydantic_settings import BaseSettings, SettingsConfigDict
322+
323+
321324
class Settings(BaseSettings):
322325
model_config = SettingsConfigDict(env_file='.env', env_file_encoding='utf-8')
323326
```
324327

325328
2. Instantiating the `BaseSettings` derived class with the `_env_file` keyword argument
326329
(and the `_env_file_encoding` if needed):
327330

328-
```py test="skip" lint="skip"
331+
```py hl_lines="8"
332+
from pydantic_settings import BaseSettings, SettingsConfigDict
333+
334+
335+
class Settings(BaseSettings):
336+
model_config = SettingsConfigDict(env_file='.env', env_file_encoding='utf-8')
337+
338+
329339
settings = Settings(_env_file='prod.env', _env_file_encoding='utf-8')
330340
```
331341

@@ -347,7 +357,10 @@ while `.env` would be ignored.
347357
If you need to load multiple dotenv files, you can pass multiple file paths as a tuple or list. The files will be
348358
loaded in order, with each file overriding the previous one.
349359

350-
```py test="skip" lint="skip"
360+
```py
361+
from pydantic_settings import BaseSettings, SettingsConfigDict
362+
363+
351364
class Settings(BaseSettings):
352365
model_config = SettingsConfigDict(
353366
# `.env.prod` takes priority over `.env`
@@ -381,7 +394,10 @@ Once you have your secret files, *pydantic* supports loading it in two ways:
381394

382395
1. Setting the `secrets_dir` on `model_config` in a `BaseSettings` class to the directory where your secret files are stored.
383396

384-
```py test="skip" lint="skip"
397+
```py hl_lines="4 5 6 7"
398+
from pydantic_settings import BaseSettings, SettingsConfigDict
399+
400+
385401
class Settings(BaseSettings):
386402
model_config = SettingsConfigDict(secrets_dir='/var/run')
387403

@@ -390,7 +406,7 @@ class Settings(BaseSettings):
390406

391407
2. Instantiating the `BaseSettings` derived class with the `_secrets_dir` keyword argument:
392408

393-
```py test="skip" lint="skip"
409+
```
394410
settings = Settings(_secrets_dir='/var/run')
395411
```
396412

@@ -413,7 +429,10 @@ and using secrets in Docker see the official
413429

414430
First, define your `Settings` class with a `SettingsConfigDict` that specifies the secrets directory.
415431

416-
```py test="skip" lint="skip"
432+
```py hl_lines="4 5 6 7"
433+
from pydantic_settings import BaseSettings, SettingsConfigDict
434+
435+
417436
class Settings(BaseSettings):
418437
model_config = SettingsConfigDict(secrets_dir='/run/secrets')
419438

0 commit comments

Comments
 (0)