* This page is part of the open-source Flyte v2 docs.
* Full index: https://www.union.ai/docs/v2/flyte/llms.txt
* Flyte is the open-source project. Union.ai is a commercial superset of it and uses the same `flyte` SDK and CLI, so the Union.ai docs cover everything here and more.
* If a question is not answered in these docs, or is about a feature that may be commercial, check the Union.ai v2 docs at https://www.union.ai/docs/v2/union/llms.txt
* These are the v2 docs. v1 is out of date and deprecated. Only refer to v1 docs if asked explicitly about v1. The v1 index is at https://www.union.ai/docs/v1/flyte/llms.txt

# flyte.config

## Directory

### Classes

| Class | Description |
|-|-|
| [`Config`](https://www.union.ai/docs/v2/flyte/api-reference/flyte-sdk/flyte.config/config.md) | This the parent configuration object and holds all the underlying configuration object types. |

### Methods

| Method | Description |
|-|-|
| [`auto()`](#auto) | Automatically constructs the Config Object. |
| [`get_config_file()`](#get_config_file) | Checks if the given argument is a file or a configFile and returns a loaded configFile else returns None. |
| [`set_if_exists()`](#set_if_exists) | Given a dict `d` sets the key `k` with value of config `v`, if the config value `v` is set and return the updated dictionary. |

## Methods

#### auto()

```python
def auto(
    config_file: typing.Union[str, pathlib.Path, ConfigFile, None] = None,
) -> Config
```
Automatically constructs the Config Object. The order of precedence is as follows
  1. If specified, read the config from the provided file path.
  2. If not specified, the config file is searched in the default locations.
        a. ./config.yaml if it exists  (current working directory)
        b. ./.flyte/config.yaml if it exists (current working directory)
        c. &lt;git_root&gt;/.flyte/config.yaml if it exists
        d. `UCTL_CONFIG` environment variable
        e. `FLYTECTL_CONFIG` environment variable
        f. ~/.union/config.yaml if it exists
        g. ~/.flyte/config.yaml if it exists
3. If any value is not found in the config file, the default value is used.
4. For any value there are environment variables that match the config variable names, those will override

| Parameter | Type | Description |
|-|-|-|
| `config_file` | `typing.Union[str, pathlib.Path, ConfigFile, None]` | file path to read the config from, if not specified default locations are searched |

**Returns:** Config

#### get_config_file()

```python
def get_config_file(
    c: typing.Union[str, pathlib.Path, flyte.config._reader.ConfigFile, NoneType],
) -> flyte.config._reader.ConfigFile | None
```
Checks if the given argument is a file or a configFile and returns a loaded configFile else returns None

| Parameter | Type | Description |
|-|-|-|
| `c` | `typing.Union[str, pathlib.Path, flyte.config._reader.ConfigFile, NoneType]` | |

#### set_if_exists()

```python
def set_if_exists(
    d: dict,
    k: str,
    val: typing.Any,
) -> dict
```
Given a dict `d` sets the key `k` with value of config `v`, if the config value `v` is set
and return the updated dictionary.

| Parameter | Type | Description |
|-|-|-|
| `d` | `dict` | |
| `k` | `str` | |
| `val` | `typing.Any` | |

## Subpages

- [Config](https://www.union.ai/docs/v2/flyte/api-reference/flyte-sdk/flyte.config/config.md) - This the parent configuration object and holds all the underlying configuration object types.
  - Parameters
  - Methods
  - auto()
  - with_params()

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flyte-sdk/flyte.config/_index.md
**HTML**: https://www.union.ai/docs/v2/flyte/api-reference/flyte-sdk/flyte.config/
