From 2ffbb7f711f647aa6ba31a1f28072ebfcb4d7dc7 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 1 Dec 2017 18:44:28 +0900 Subject: [PATCH] ing --- config/config.go | 7 +++++++ .../noauthprobe/NoAuthProbeConfig.go | 6 +----- config/noauthprobe/noauthprobe.go | 5 +++++ .../config.go => config/probe/CentralConfig.go | 15 +-------------- config/probe/Config.go | 6 ++++++ config/probe/ProbeConfig.go | 5 +++++ config/probe/probe.go | 5 +++++ 7 files changed, 30 insertions(+), 19 deletions(-) create mode 100644 config/config.go rename modules/noauthprobe/config/config.go => config/noauthprobe/NoAuthProbeConfig.go (78%) create mode 100644 config/noauthprobe/noauthprobe.go rename modules/probe/config/config.go => config/probe/CentralConfig.go (57%) create mode 100644 config/probe/Config.go create mode 100644 config/probe/ProbeConfig.go create mode 100644 config/probe/probe.go diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..53ec1d2 --- /dev/null +++ b/config/config.go @@ -0,0 +1,7 @@ +package config + +import "flag" + +func FlagConfigDir() *string { + return flag.String("config-dir", ".", "The directory path of config") +} diff --git a/modules/noauthprobe/config/config.go b/config/noauthprobe/NoAuthProbeConfig.go similarity index 78% rename from modules/noauthprobe/config/config.go rename to config/noauthprobe/NoAuthProbeConfig.go index a76f2c8..ee1554c 100644 --- a/modules/noauthprobe/config/config.go +++ b/config/noauthprobe/NoAuthProbeConfig.go @@ -1,11 +1,7 @@ -package config +package noauthprobe import "git.loafle.net/overflow/overflow_commons_go/util" -const ( - NoAuthProbeConfigFileName = "noauthprobe.json" -) - type NoAuthProbeConfig struct { TempKey *string `json:"tempKey,omitempty" yaml:"tempKey" toml:"tempKey"` DenyDate *util.Timestamp `json:"denyDate,omitempty" yaml:"denyDate" toml:"denyDate"` diff --git a/config/noauthprobe/noauthprobe.go b/config/noauthprobe/noauthprobe.go new file mode 100644 index 0000000..96021b9 --- /dev/null +++ b/config/noauthprobe/noauthprobe.go @@ -0,0 +1,5 @@ +package noauthprobe + +const ( + ConfigFileName = "noauthprobe.json" +) diff --git a/modules/probe/config/config.go b/config/probe/CentralConfig.go similarity index 57% rename from modules/probe/config/config.go rename to config/probe/CentralConfig.go index 6f25eb9..ec4c96a 100644 --- a/modules/probe/config/config.go +++ b/config/probe/CentralConfig.go @@ -1,13 +1,4 @@ -package config - -const ( - ConfigFileName = "config.json" -) - -type Config struct { - Central CentralConfig `json:"central" yaml:"central" toml:"central"` - Probe ProbeConfig `json:"probe" yaml:"probe" toml:"probe"` -} +package probe type CentralConfig struct { URL string `required:"true" json:"url" yaml:"url" toml:"url"` @@ -15,7 +6,3 @@ type CentralConfig struct { ReadBufferSize int `default:"8192" json:"readBufferSize" yaml:"readBufferSize" toml:"readBufferSize"` WriteBufferSize int `default:"8192" json:"writeBufferSize" yaml:"writeBufferSize" toml:"writeBufferSize"` } - -type ProbeConfig struct { - Key *string `json:"key,omitempty" yaml:"key" toml:"key"` -} diff --git a/config/probe/Config.go b/config/probe/Config.go new file mode 100644 index 0000000..c5983a4 --- /dev/null +++ b/config/probe/Config.go @@ -0,0 +1,6 @@ +package probe + +type Config struct { + Central CentralConfig `json:"central" yaml:"central" toml:"central"` + Probe ProbeConfig `json:"probe" yaml:"probe" toml:"probe"` +} diff --git a/config/probe/ProbeConfig.go b/config/probe/ProbeConfig.go new file mode 100644 index 0000000..8f9b656 --- /dev/null +++ b/config/probe/ProbeConfig.go @@ -0,0 +1,5 @@ +package probe + +type ProbeConfig struct { + Key *string `json:"key,omitempty" yaml:"key" toml:"key"` +} diff --git a/config/probe/probe.go b/config/probe/probe.go new file mode 100644 index 0000000..aa7d996 --- /dev/null +++ b/config/probe/probe.go @@ -0,0 +1,5 @@ +package probe + +const ( + ConfigFileName = "config.json" +) \ No newline at end of file