# ComposeFile.AddConfig

- Module: [Aspire.Hosting.Docker](/reference/api/go/aspire.hosting.docker.md)
- Defined on: [ComposeFile](/reference/api/go/aspire.hosting.docker/composefile.md)
- Version: `17.0.0`
- Kind: `method`

Adds a top-level config definition to the Docker Compose file.

## Definition

```go
type ComposeFile interface {
    // ... omitted for brevity
    AddConfig(
        name string,
        options ...*AddConfigOptions,
    ) ComposeFile
}
```

## Signature

```go
AddConfig(
    name string,
    options ...*AddConfigOptions,
) ComposeFile
```

## Parameters

- `name` (`string`) -- The name of the config.
- `options` (`...*AddConfigOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*AddConfigOptions` argument.

- `File` (`*string`) -- The path to the config file.
- `Content` (`*string`) -- The inline config content.
- `External` (`*bool`) -- A value indicating whether the config is managed outside the generated Compose file.
- `Configure` (`func(obj Config)`) `callback` -- An optional callback for further config customization.

## Returns

[`ComposeFile`](/reference/api/go/aspire.hosting.docker/composefile.md) -- The updated Docker Compose file.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [ComposeFile](/reference/api/go/aspire.hosting.docker/composefile.md) -- `handle`
