Client APIs
Reading Environment Variables
The `getenv` function can read environment variables.  
#### Examples {#docs:api:cli:overview::examples}  
To retrieve the home directory's path from the `HOME` environment variable, use:  
```sql
SELECT getenv('HOME') AS home;
```  
|       home       |
|------------------|
| /Users/user_name |  
The output of the `getenv` function can be used to set [configuration options](#docs:configuration:overview). For example, to set the `NULL` order based on the environment variable `DEFAULT_NULL_ORDER`, use:  
```sql
SET default_null_order = getenv('DEFAULT_NULL_ORDER');
```  
#### Restrictions for Reading Environment Variables {#docs:api:cli:overview::restrictions-for-reading-environment-variables}  
The `getenv` function can only be run when the [`enable_external_access`](#docs:configuration:overview::configuration-reference) is set to `true` (the default setting).
It is only available in the CLI client and is not supported in other DuckDB clients.