示例#1
0
// RemoveDockerClient removes your specified configuration
func RemoveDockerClient(id string) bool {
	prev, _ := LoadDockerClients()
	next := []*DockerClient{}
	for _, client := range prev {
		if client.ID == id {
			continue
		}
		next = append(next, client)
	}
	misc.SaveAsFile(DockerClientSavePath, next)
	return true
}
示例#2
0
// Save persists the client configuration
func (c *DockerClient) Save() {
	clients, _ := LoadDockerClients()
	found := false
	for _, client := range clients {
		if client.Endpoint == c.Endpoint {
			client.CertPath = c.CertPath
			client.IsActive = c.IsActive
			found = true
		}
	}
	if !found {
		clients = append(clients, c)
	}
	misc.SaveAsFile(DockerClientSavePath, clients)
}