diff --git a/cli/server.go b/cli/server.go index c0d7d6fcee13e..98a7739412afa 100644 --- a/cli/server.go +++ b/cli/server.go @@ -653,6 +653,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd. SSHConfig: codersdk.SSHConfigResponse{ HostnamePrefix: vals.SSHConfig.DeploymentName.String(), SSHConfigOptions: configSSHOptions, + HostnameSuffix: vals.WorkspaceHostnameSuffix.String(), }, AllowWorkspaceRenames: vals.AllowWorkspaceRenames.Value(), Entitlements: entitlements.New(), diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index c31ff68c9b147..ae566ee62208e 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -14754,6 +14754,11 @@ const docTemplate = `{ "type": "object", "properties": { "hostname_prefix": { + "description": "HostnamePrefix is the prefix we append to workspace names for SSH hostnames.\nDeprecated: use HostnameSuffix instead.", + "type": "string" + }, + "hostname_suffix": { + "description": "HostnameSuffix is the suffix to append to workspace names for SSH hostnames.", "type": "string" }, "ssh_config_options": { diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 982daead86e69..897ff44187a63 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -13384,6 +13384,11 @@ "type": "object", "properties": { "hostname_prefix": { + "description": "HostnamePrefix is the prefix we append to workspace names for SSH hostnames.\nDeprecated: use HostnameSuffix instead.", + "type": "string" + }, + "hostname_suffix": { + "description": "HostnameSuffix is the suffix to append to workspace names for SSH hostnames.", "type": "string" }, "ssh_config_options": { diff --git a/codersdk/deployment.go b/codersdk/deployment.go index a3e690ed67b08..089bd11567ab7 100644 --- a/codersdk/deployment.go +++ b/codersdk/deployment.go @@ -3393,7 +3393,12 @@ type DeploymentStats struct { } type SSHConfigResponse struct { - HostnamePrefix string `json:"hostname_prefix"` + // HostnamePrefix is the prefix we append to workspace names for SSH hostnames. + // Deprecated: use HostnameSuffix instead. + HostnamePrefix string `json:"hostname_prefix"` + + // HostnameSuffix is the suffix to append to workspace names for SSH hostnames. + HostnameSuffix string `json:"hostname_suffix"` SSHConfigOptions map[string]string `json:"ssh_config_options"` } diff --git a/docs/reference/api/general.md b/docs/reference/api/general.md index d1c4e2d5970f7..20372423f12ad 100644 --- a/docs/reference/api/general.md +++ b/docs/reference/api/general.md @@ -582,6 +582,7 @@ curl -X GET http://coder-server:8080/api/v2/deployment/ssh \ ```json { "hostname_prefix": "string", + "hostname_suffix": "string", "ssh_config_options": { "property1": "string", "property2": "string" diff --git a/docs/reference/api/schemas.md b/docs/reference/api/schemas.md index a3b11bf0f9f26..0fbf87e8e5ff9 100644 --- a/docs/reference/api/schemas.md +++ b/docs/reference/api/schemas.md @@ -5748,6 +5748,7 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith ```json { "hostname_prefix": "string", + "hostname_suffix": "string", "ssh_config_options": { "property1": "string", "property2": "string" @@ -5757,11 +5758,12 @@ Git clone makes use of this by parsing the URL from: 'Username for "https://gith ### Properties -| Name | Type | Required | Restrictions | Description | -|----------------------|--------|----------|--------------|-------------| -| `hostname_prefix` | string | false | | | -| `ssh_config_options` | object | false | | | -| » `[any property]` | string | false | | | +| Name | Type | Required | Restrictions | Description | +|----------------------|--------|----------|--------------|-----------------------------------------------------------------------------------------------------------------------| +| `hostname_prefix` | string | false | | Hostname prefix is the prefix we append to workspace names for SSH hostnames. Deprecated: use HostnameSuffix instead. | +| `hostname_suffix` | string | false | | Hostname suffix is the suffix to append to workspace names for SSH hostnames. | +| `ssh_config_options` | object | false | | | +| » `[any property]` | string | false | | | ## codersdk.ServerSentEvent diff --git a/site/src/api/typesGenerated.ts b/site/src/api/typesGenerated.ts index 1f5af620130d1..eb14392ed408a 100644 --- a/site/src/api/typesGenerated.ts +++ b/site/src/api/typesGenerated.ts @@ -2219,6 +2219,7 @@ export interface SSHConfig { // From codersdk/deployment.go export interface SSHConfigResponse { readonly hostname_prefix: string; + readonly hostname_suffix: string; readonly ssh_config_options: Record; } diff --git a/site/src/testHelpers/entities.ts b/site/src/testHelpers/entities.ts index a298dea4ffd9d..f69b8f98db6a0 100644 --- a/site/src/testHelpers/entities.ts +++ b/site/src/testHelpers/entities.ts @@ -3032,6 +3032,7 @@ export const MockDeploymentStats: TypesGen.DeploymentStats = { export const MockDeploymentSSH: TypesGen.SSHConfigResponse = { hostname_prefix: " coder.", ssh_config_options: {}, + hostname_suffix: "coder", }; export const MockWorkspaceAgentLogs: TypesGen.WorkspaceAgentLog[] = [