Declarations

Declare variable names and the rules they must follow

Dotenv.toml

Save the file as Dotenv.toml in your project directory. It contains names and rules. Values stay in .env or your other environment sources.

Declare each variable as a table such as [env.DATABASE_URL]. Variable names are case-sensitive and must match [A-Za-z_][A-Za-z0-9_]*. Comments begin with #.


# Dotenv.toml
strict = true

[env.DATABASE_URL]
type = "url"
required = true
storage = "encrypted"
redacted = true

[env.SENTRY_DSN]
optional = true

Variables are optional by default. The default type is "string", storage is "any", and redaction is off. Set rules explicitly or use root settings to change the defaults.

Put each setting on its own line within the table.


[env.PORT]
type = "port"
storage = "plaintext"
redacted = false

Settings

markdown