refactor global config into subpackage

This commit is contained in:
Bradley Cicenas
2017-02-07 03:33:09 +00:00
parent d5d00b730b
commit 85cd6864ba
6 changed files with 24 additions and 18 deletions

View File

@@ -7,13 +7,14 @@ import (
"strings"
"github.com/bcicen/ctop/collector"
"github.com/bcicen/ctop/config"
"github.com/bcicen/ctop/widgets"
"github.com/fsouza/go-dockerclient"
)
func NewContainerMap() *ContainerMap {
// init docker client
client, err := docker.NewClient(GlobalConfig["dockerHost"])
client, err := docker.NewClient(config.Global["dockerHost"])
if err != nil {
panic(err)
}
@@ -99,7 +100,7 @@ func (cm *ContainerMap) Del(ids ...string) {
func (cm *ContainerMap) All() []*Container {
var containers Containers
filter := GlobalConfig["filterStr"]
filter := config.Global["filterStr"]
re := regexp.MustCompile(fmt.Sprintf(".*%s", filter))
for _, c := range cm.containers {