Clusters : port 8006 par défaut, liste des cibles jamais null
This commit is contained in:
1 parent
8dd2f187ee
commit
ee8343c69f
5 files changed
+50
-3
No files matched your search
@@ -283,7 +283,7 @@ func (s *Store) connection(c Cluster, blob []byte) (config.Cluster, error) {
|
||||
if err != nil {
|
||||
return config.Cluster{}, fmt.Errorf("cluster %s: password: %w", c.Name, err)
|
||||
}
|
||||
cc := config.Cluster{Name: c.Name, URL: c.URL, User: c.User, Password: string(pass), Timeout: c.Timeout,
|
||||
cc := config.Cluster{Name: c.Name, URL: config.NormalizeURL(c.URL), User: c.User, Password: string(pass), Timeout: c.Timeout,
|
||||
SSHHost: c.SSHHost, SSHPort: c.SSHPort, SSHHostKey: c.SSHHostKey}
|
||||
switch c.TLS {
|
||||
case TLSPin:
|
||||
@@ -307,7 +307,7 @@ func ValidClusterRole(r string) bool {
|
||||
// are forgotten when the address they belong to changes.
|
||||
func (s *Store) SaveCluster(ctx context.Context, oldName string, c Cluster) error {
|
||||
c.Name = strings.TrimSpace(c.Name)
|
||||
c.URL = strings.TrimRight(strings.TrimSpace(c.URL), "/")
|
||||
c.URL = config.NormalizeURL(c.URL)
|
||||
if c.Name == "" || c.URL == "" {
|
||||
return errors.New("name and url are required")
|
||||
}
|
||||
@@ -509,6 +509,13 @@ func (s *Store) Settings(ctx context.Context) (Settings, error) {
|
||||
if len(st.Kinds) == 0 {
|
||||
st.Kinds = append(st.Kinds, model.Kinds...)
|
||||
}
|
||||
// empty maps, not null, for the web UI
|
||||
if st.Objects == nil {
|
||||
st.Objects = map[model.Kind]config.Selection{}
|
||||
}
|
||||
if st.Policies == nil {
|
||||
st.Policies = map[model.Kind]map[string]adapter.Policy{}
|
||||
}
|
||||
return st, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user