# WithHostPort

- Module: [Aspire.Hosting.Redis](/reference/api/go/aspire.hosting.redis.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`RedisCommanderResource`](/reference/api/go/aspire.hosting.redis/rediscommanderresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Configures the host port that the Redis Commander resource is exposed on instead of using randomly assigned port.

## Definition

```go
func (RedisCommanderResource) WithHostPort(port *float64) RedisCommanderResource
```

## Parameters

- `port` (`*float64`) -- The port to bind on the host. If `null` is used random port will be assigned.

## Returns

[`RedisCommanderResource`](/reference/api/go/aspire.hosting.redis/rediscommanderresource.md) -- The resource builder for RedisCommander.

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

## Applies to

- [`RedisCommanderResource`](/reference/api/go/aspire.hosting.redis/rediscommanderresource.md)
