mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Enable custom support links (#6313)
* backend: support links * frontend: Support links * fmt * test: CODER_SUPPORT_LINKS_0_NAME * Go tests * Use UpdateAppearanceConfig * ui: UpdateAppearanceConfig * fix: fmt * Fix: site * Fix: site tests * fix: fmt * fix * test: check default support links
This commit is contained in:
@@ -570,6 +570,15 @@ func newConfig() *codersdk.DeploymentConfig {
|
||||
Flag: "disable-password-auth",
|
||||
Default: false,
|
||||
},
|
||||
Support: &codersdk.SupportConfig{
|
||||
Links: &codersdk.DeploymentConfigField[[]codersdk.LinkConfig]{
|
||||
Name: "Support links",
|
||||
Usage: "Use custom support links",
|
||||
Flag: "support-links",
|
||||
Default: []codersdk.LinkConfig{},
|
||||
Enterprise: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -649,6 +658,10 @@ func setConfig(prefix string, vip *viper.Viper, target interface{}) {
|
||||
// Do not bind to CODER_GITAUTH, instead bind to CODER_GITAUTH_0_*, etc.
|
||||
values := readSliceFromViper[codersdk.GitAuthConfig](vip, prefix, value)
|
||||
val.FieldByName("Value").Set(reflect.ValueOf(values))
|
||||
case []codersdk.LinkConfig:
|
||||
// Do not bind to CODER_SUPPORT_LINKS, instead bind to CODER_SUPPORT_LINKS_0_*, etc.
|
||||
values := readSliceFromViper[codersdk.LinkConfig](vip, prefix, value)
|
||||
val.FieldByName("Value").Set(reflect.ValueOf(values))
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported type %T", value))
|
||||
}
|
||||
@@ -824,6 +837,8 @@ func setFlags(prefix string, flagset *pflag.FlagSet, vip *viper.Viper, target in
|
||||
_ = flagset.DurationP(flg, shorthand, vip.GetDuration(prefix), usage)
|
||||
case []string:
|
||||
_ = flagset.StringSliceP(flg, shorthand, vip.GetStringSlice(prefix), usage)
|
||||
case []codersdk.LinkConfig:
|
||||
// Ignore this one!
|
||||
case []codersdk.GitAuthConfig:
|
||||
// Ignore this one!
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user