Skip to content

Commit

Permalink
Merge pull request #47 from adsri/config_file_error_handling
Browse files Browse the repository at this point in the history
Error handling while creating client using config file data
  • Loading branch information
Ishant Tyagi authored Sep 4, 2017
2 parents d36c8dd + 3d94342 commit 3db2d04
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 4 deletions.
16 changes: 16 additions & 0 deletions common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package common

import (
"flag"
"fmt"
"github.com/BurntSushi/toml"
"github.com/Sirupsen/logrus"
"github.com/caarlos0/env"
Expand All @@ -27,6 +28,11 @@ type GridConfig struct {
HttpPoolConnections uint `toml:"http-pool-connections" env:"HTTP_POOL_CONNECTIONS"`
}

func (gc GridConfig) String() string {
return fmt.Sprintf("{GridHost: %v, WapiVer: %v, WapiPort: %v, WapiUsername: %v, SslVerify: %v, HttpRequestTimeout: %v, HttpPoolConnections: %v}",
gc.GridHost, gc.WapiVer, gc.WapiPort, gc.WapiUsername, gc.SslVerify, gc.HttpRequestTimeout, gc.HttpPoolConnections)
}

type IpamConfig struct {
GlobalNetview string `toml:"global-view" env:"GLOBAL_VIEW"`
GlobalNetworkContainer string `toml:"global-network-container" env:"GLOBAL_NETWORK_CONTAINER"`
Expand All @@ -43,12 +49,22 @@ type PluginConfig struct {
IpamConfig `toml:"ipam-config"`
}

func (pc PluginConfig) String() string {
return fmt.Sprintf("{ConfigFile: %v, Debug: %v, GridConfig: %v, IpamConfig: %v}",
pc.ConfigFile, pc.Debug, pc.GridConfig, pc.IpamConfig)
}

type CreateEADefConfig struct {
ConfigFile string `toml:""`
Debug bool `toml:"debug"`
GridConfig `toml:"grid-config"`
}

func (eac CreateEADefConfig) String() string {
return fmt.Sprintf("{ConfigFile: %v, Debug: %v, GridConfig: %v}",
eac.ConfigFile, eac.Debug, eac.GridConfig)
}

func NewGridConfig() GridConfig {
return GridConfig{
GridHost: "",
Expand Down
2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import:
subpackages:
- netlabel
- package: github.com/infobloxopen/infoblox-go-client
version: e3afa79f174f4ef5932d24c97d69fdf6569bd3c5
version: a7011ba7a38b75b63269695c4c392ebd1d8b0c72
- package: golang.org/x/net
subpackages:
- context
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions vendor/github.com/infobloxopen/infoblox-go-client/objects.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3db2d04

Please sign in to comment.