mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
481568035f
Signed-off-by: Madhu Venugopal <madhu@docker.com>
43 lines
939 B
Go
43 lines
939 B
Go
package config
|
|
|
|
import "github.com/BurntSushi/toml"
|
|
|
|
// Config encapsulates configurations of various Libnetwork components
|
|
type Config struct {
|
|
Daemon DaemonCfg
|
|
Cluster ClusterCfg
|
|
Datastore DatastoreCfg
|
|
}
|
|
|
|
// DaemonCfg represents libnetwork core configuration
|
|
type DaemonCfg struct {
|
|
Debug bool
|
|
}
|
|
|
|
// ClusterCfg represents cluster configuration
|
|
type ClusterCfg struct {
|
|
Discovery string
|
|
Address string
|
|
Heartbeat uint64
|
|
}
|
|
|
|
// DatastoreCfg represents Datastore configuration.
|
|
type DatastoreCfg struct {
|
|
Embedded bool
|
|
Client DatastoreClientCfg
|
|
}
|
|
|
|
// DatastoreClientCfg represents Datastore Client-only mode configuration
|
|
type DatastoreClientCfg struct {
|
|
Provider string
|
|
Address string
|
|
}
|
|
|
|
// ParseConfig parses the libnetwork configuration file
|
|
func ParseConfig(tomlCfgFile string) (*Config, error) {
|
|
var cfg Config
|
|
if _, err := toml.DecodeFile(tomlCfgFile, &cfg); err != nil {
|
|
return nil, err
|
|
}
|
|
return &cfg, nil
|
|
}
|