mirror of
https://github.com/coder/coder.git
synced 2025-07-23 21:32:07 +00:00
fix: make cli respect deployment --docs-url (#14568)
This commit is contained in:
@ -2,10 +2,7 @@ package appearance
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/coder/coder/v2/buildinfo"
|
||||
"github.com/coder/coder/v2/codersdk"
|
||||
)
|
||||
|
||||
@ -13,37 +10,6 @@ type Fetcher interface {
|
||||
Fetch(ctx context.Context) (codersdk.AppearanceConfig, error)
|
||||
}
|
||||
|
||||
func DefaultSupportLinks(docsURL string) []codersdk.LinkConfig {
|
||||
version := buildinfo.Version()
|
||||
if docsURL == "" {
|
||||
docsURL = "https://coder.com/docs/@" + strings.Split(version, "-")[0]
|
||||
}
|
||||
buildInfo := fmt.Sprintf("Version: [`%s`](%s)", version, buildinfo.ExternalURL())
|
||||
|
||||
return []codersdk.LinkConfig{
|
||||
{
|
||||
Name: "Documentation",
|
||||
Target: docsURL,
|
||||
Icon: "docs",
|
||||
},
|
||||
{
|
||||
Name: "Report a bug",
|
||||
Target: "https://github.com/coder/coder/issues/new?labels=needs+grooming&body=" + buildInfo,
|
||||
Icon: "bug",
|
||||
},
|
||||
{
|
||||
Name: "Join the Coder Discord",
|
||||
Target: "https://coder.com/chat?utm_source=coder&utm_medium=coder&utm_campaign=server-footer",
|
||||
Icon: "chat",
|
||||
},
|
||||
{
|
||||
Name: "Star the Repo",
|
||||
Target: "https://github.com/coder/coder",
|
||||
Icon: "star",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type AGPLFetcher struct {
|
||||
docsURL string
|
||||
}
|
||||
@ -51,11 +17,15 @@ type AGPLFetcher struct {
|
||||
func (f AGPLFetcher) Fetch(context.Context) (codersdk.AppearanceConfig, error) {
|
||||
return codersdk.AppearanceConfig{
|
||||
AnnouncementBanners: []codersdk.BannerConfig{},
|
||||
SupportLinks: DefaultSupportLinks(f.docsURL),
|
||||
SupportLinks: codersdk.DefaultSupportLinks(f.docsURL),
|
||||
DocsURL: f.docsURL,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewDefaultFetcher(docsURL string) Fetcher {
|
||||
if docsURL == "" {
|
||||
docsURL = codersdk.DefaultDocsURL()
|
||||
}
|
||||
return &AGPLFetcher{
|
||||
docsURL: docsURL,
|
||||
}
|
||||
|
Reference in New Issue
Block a user