Skip to content

Support branch-to-domain mapping in deployment configuration #896

@pec1985

Description

@pec1985

Problem

When deploying Agentuity projects, the deployment.domains configuration in agentuity.json only accepts a flat array of domain strings. All configured domains are applied to every deployment, regardless of which git branch is being deployed.

This means there's no way to associate specific custom domains with specific branches. For example, a common multi-environment setup would be:

  • main branchapp.example.com, www.example.com
  • staging branchstaging.example.com
  • dev branchdev.example.com

Today, users must either:

  1. Manually edit agentuity.json before deploying each branch
  2. Use separate profile files (agentuity.staging.json) and remember to pass --profile on every deploy
  3. Handle it in CI with custom logic to swap domains before deploying

None of these are ergonomic for the common "branch = environment" pattern.

Proposed Solution

Extend the domains property to accept either its current format (flat array, backward compatible) or a branch-keyed map:

{
  "deployment": {
    "domains": {
      "*": ["app.example.com", "www.example.com"],
      "staging": ["staging.example.com"],
      "dev": ["dev.example.com"]
    }
  }
}

Where:

  • * is the wildcard key matching default branches (main, master), or used when no branch is detected
  • Other keys are exact branch name matches
  • At deploy time, the CLI resolves the map to a flat array based on the current git branch (auto-detected or via --branch flag)
  • The API contract is unchanged — the server always receives a flat string[]

CLI Support

Add a --branch flag to agentuity project add domain:

# Add domain for staging branch
agentuity project add domain staging.example.com --branch staging

# Add domain for default/main branch
agentuity project add domain app.example.com --branch "*"

# Existing flat array behavior (unchanged)
agentuity project add domain app.example.com

When --branch is first used on a project with an existing flat domain array, the existing domains are automatically migrated to the * key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions