Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
getty
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
getty
Commits
2c573b8f
Commit
2c573b8f
authored
Aug 19, 2018
by
AlexStocks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mod: use yml config instead of toml
parent
222f82f0
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
155 additions
and
163 deletions
+155
-163
change_log.md
micro/change_log.md
+1
-0
config.go
micro/client/app/config.go
+17
-5
version.go
micro/client/app/version.go
+1
-1
app.properties
micro/client/assembly/common/app.properties
+1
-1
config.toml
micro/client/profiles/dev/config.toml
+0
-51
config.yml
micro/client/profiles/dev/config.yml
+45
-0
config.toml
micro/client/profiles/release/config.toml
+0
-51
config.yml
micro/client/profiles/release/config.yml
+45
-0
config.toml
micro/client/profiles/test/config.toml
+0
-51
config.yml
micro/client/profiles/test/config.yml
+45
-0
config.go
micro/server/app/config.go
+0
-3
No files found.
micro/change_log.md
View file @
2c573b8f
...
...
@@ -13,6 +13,7 @@
-
2018/08/19
> Feature
*
use multiple service config
*
Config using yml file instead toml
-
2018/08/13
> Init
...
...
micro/client/app/config.go
View file @
2c573b8f
...
...
@@ -11,6 +11,7 @@ package main
import
(
"fmt"
"io/ioutil"
"os"
"path"
)
...
...
@@ -20,7 +21,7 @@ import (
"github.com/AlexStocks/getty/rpc"
log
"github.com/AlexStocks/log4go"
jerrors
"github.com/juju/errors"
config
"github.com/koding/multiconfig
"
"gopkg.in/yaml.v2
"
)
const
(
...
...
@@ -29,8 +30,8 @@ const (
)
type
microConfig
struct
{
rpc
.
ClientConfig
Registry
micro
.
RegistryConfig
rpc
.
ClientConfig
`yaml:"core" json:"core, omitempty"`
Registry
micro
.
ConsumerRegistryConfig
`yaml:"registry" json:"registry, omitempty"`
}
var
(
...
...
@@ -44,13 +45,24 @@ func initConf() {
panic
(
fmt
.
Sprintf
(
"application configure file name is nil"
))
return
// I know it is of no usage. Just Err Protection.
}
if
path
.
Ext
(
confFile
)
!=
".
to
ml"
{
if
path
.
Ext
(
confFile
)
!=
".
y
ml"
{
panic
(
fmt
.
Sprintf
(
"application configure file name{%v} suffix must be .toml"
,
confFile
))
return
}
conf
=
&
microConfig
{}
config
.
MustLoadWithPath
(
confFile
,
conf
)
confFileStream
,
err
:=
ioutil
.
ReadFile
(
confFile
)
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"ioutil.ReadFile(file:%s) = error:%s"
,
confFile
,
jerrors
.
ErrorStack
(
err
)))
return
}
err
=
yaml
.
Unmarshal
(
confFileStream
,
conf
)
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"yaml.Unmarshal() = error:%s"
,
jerrors
.
ErrorStack
(
err
)))
return
}
if
err
:=
conf
.
ClientConfig
.
CheckValidity
();
err
!=
nil
{
panic
(
jerrors
.
ErrorStack
(
err
))
return
...
...
micro/client/app/version.go
View file @
2c573b8f
...
...
@@ -10,5 +10,5 @@
package
main
var
(
Version
=
"1.0.
1
"
Version
=
"1.0.
2
"
)
micro/client/assembly/common/app.properties
View file @
2c573b8f
...
...
@@ -12,6 +12,6 @@
export
TARGET_EXEC_NAME
=
"micro_client"
export
BUILD_PACKAGE
=
"app"
export
TARGET_CONF_FILE
=
"conf/config.
to
ml"
export
TARGET_CONF_FILE
=
"conf/config.
y
ml"
export
TARGET_LOG_CONF_FILE
=
"conf/log.xml"
micro/client/profiles/dev/config.toml
deleted
100644 → 0
View file @
222f82f0
# toml configure file
# toml中key的首字母可以小写,但是对应的golang中的struct成员首字母必须大写
AppName
=
"MICRO-CLIENT"
# host
LocalHost
=
"127.0.0.1"
# server
ServerHost
=
"127.0.0.1"
ServerPort
=
10000
ProfilePort
=
10080
# connection pool
# 连接池连接数目
ConnectionNum
=
2
# session
# client与server之间连接的心跳周期
HeartbeatPeriod
=
"10s"
# client与server之间连接的超时时间
SessionTimeout
=
"20s"
# app fail fast
FailFastTimeout
=
"3s"
# tcp
[GettySessionParam]
CompressEncoding
=
true
TcpNoDelay
=
true
TcpKeepAlive
=
true
KeepAlivePeriod
=
"120s"
TcpRBufSize
=
262144
TcpWBufSize
=
65536
PkgRQSize
=
512
PkgWQSize
=
256
TcpReadTimeout
=
"1s"
TcpWriteTimeout
=
"5s"
WaitTimeout
=
"1s"
MaxMsgLen
=
1024
SessionName
=
"getty-micro-client"
[Registry]
Type
=
"zookeeper"
Addr
=
"127.0.0.1:2181"
# 与 registry 之间的 lease 时长
KeepaliveTimeout
=
10
Root
=
"/getty-root"
IDC
=
"bj-yizhuang"
NodeID
=
"clt-node1"
Codec
=
"protobuf"
micro/client/profiles/dev/config.yml
0 → 100644
View file @
2c573b8f
core
:
app_name
:
"
MICRO-CLIENT"
host
:
"
127.0.0.1"
profile_port
:
20086
# client 与 server单个peer与peer之间连接数目
connection_number
:
2
# session
# client与server之间连接的心跳周期
heartbeat_period
:
"
10s"
# client与server之间连接的超时时间
session_timeout
:
"
20s"
# app fail fast
fail_fast_timeout
:
"
3s"
# connection pool
pool_size
:
64
pool_ttl
:
600
# tcp
getty_session_param
:
compress_encoding
:
true
tcp_no_delay
:
true
tcp_keep_alive
:
true
keep_alive_period
:
"
120s"
tcp_r_buf_size
:
262144
tcp_w_buf_size
:
65536
pkg_rq_size
:
1024
pkg_wq_size
:
512
tcp_read_timeout
:
"
1s"
tcp_write_timeout
:
"
5s"
wait_timeout
:
"
1s"
max_msg_len
:
1024
session_name
:
"
getty-micro-server"
registry
:
basic
:
type
:
"
zookeeper"
reg_addr
:
"
127.0.0.1:2181"
# 与 registry 之间的 lease 时长
keepalive_timeout
:
10
root
:
"
/getty"
group
:
"
bj-yizhuang"
\ No newline at end of file
micro/client/profiles/release/config.toml
deleted
100644 → 0
View file @
222f82f0
# toml configure file
# toml中key的首字母可以小写,但是对应的golang中的struct成员首字母必须大写
AppName
=
"MICRO-CLIENT"
# host
LocalHost
=
"127.0.0.1"
# server
ServerHost
=
"127.0.0.1"
ServerPort
=
10000
ProfilePort
=
10080
# connection pool
# 连接池连接数目
ConnectionNum
=
2
# session
# client与server之间连接的心跳周期
HeartbeatPeriod
=
"10s"
# client与server之间连接的超时时间
SessionTimeout
=
"20s"
# app fail fast
FailFastTimeout
=
"3s"
# tcp
[GettySessionParam]
CompressEncoding
=
true
TcpNoDelay
=
true
TcpKeepAlive
=
true
KeepAlivePeriod
=
"120s"
TcpRBufSize
=
262144
TcpWBufSize
=
65536
PkgRQSize
=
512
PkgWQSize
=
256
TcpReadTimeout
=
"1s"
TcpWriteTimeout
=
"5s"
WaitTimeout
=
"1s"
MaxMsgLen
=
1024
SessionName
=
"getty-micro-client"
[Registry]
Type
=
"zookeeper"
Addr
=
"127.0.0.1:2181"
# 与 registry 之间的 lease 时长
KeepaliveTimeout
=
10
Root
=
"/getty-root"
IDC
=
"bj-yizhuang"
NodeID
=
"clt-node1"
Codec
=
"protobuf"
micro/client/profiles/release/config.yml
0 → 100644
View file @
2c573b8f
core
:
app_name
:
"
MICRO-CLIENT"
host
:
"
127.0.0.1"
profile_port
:
20086
# client 与 server单个peer与peer之间连接数目
connection_number
:
2
# session
# client与server之间连接的心跳周期
heartbeat_period
:
"
10s"
# client与server之间连接的超时时间
session_timeout
:
"
20s"
# app fail fast
fail_fast_timeout
:
"
3s"
# connection pool
pool_size
:
64
pool_ttl
:
600
# tcp
getty_session_param
:
compress_encoding
:
true
tcp_no_delay
:
true
tcp_keep_alive
:
true
keep_alive_period
:
"
120s"
tcp_r_buf_size
:
262144
tcp_w_buf_size
:
65536
pkg_rq_size
:
1024
pkg_wq_size
:
512
tcp_read_timeout
:
"
1s"
tcp_write_timeout
:
"
5s"
wait_timeout
:
"
1s"
max_msg_len
:
1024
session_name
:
"
getty-micro-server"
registry
:
basic
:
type
:
"
zookeeper"
reg_addr
:
"
127.0.0.1:2181"
# 与 registry 之间的 lease 时长
keepalive_timeout
:
10
root
:
"
/getty"
group
:
"
bj-yizhuang"
\ No newline at end of file
micro/client/profiles/test/config.toml
deleted
100644 → 0
View file @
222f82f0
# toml configure file
# toml中key的首字母可以小写,但是对应的golang中的struct成员首字母必须大写
AppName
=
"MICRO-CLIENT"
# host
LocalHost
=
"127.0.0.1"
# server
ServerHost
=
"127.0.0.1"
ServerPort
=
10000
ProfilePort
=
10080
# connection pool
# 连接池连接数目
ConnectionNum
=
2
# session
# client与server之间连接的心跳周期
HeartbeatPeriod
=
"10s"
# client与server之间连接的超时时间
SessionTimeout
=
"20s"
# app fail fast
FailFastTimeout
=
"3s"
# tcp
[GettySessionParam]
CompressEncoding
=
true
TcpNoDelay
=
true
TcpKeepAlive
=
true
KeepAlivePeriod
=
"120s"
TcpRBufSize
=
262144
TcpWBufSize
=
65536
PkgRQSize
=
512
PkgWQSize
=
256
TcpReadTimeout
=
"1s"
TcpWriteTimeout
=
"5s"
WaitTimeout
=
"1s"
MaxMsgLen
=
1024
SessionName
=
"getty-micro-client"
[Registry]
Type
=
"zookeeper"
Addr
=
"127.0.0.1:2181"
# 与 registry 之间的 lease 时长
KeepaliveTimeout
=
10
Root
=
"/getty-root"
IDC
=
"bj-yizhuang"
NodeID
=
"clt-node1"
Codec
=
"protobuf"
micro/client/profiles/test/config.yml
0 → 100644
View file @
2c573b8f
core
:
app_name
:
"
MICRO-CLIENT"
host
:
"
127.0.0.1"
profile_port
:
20086
# client 与 server单个peer与peer之间连接数目
connection_number
:
2
# session
# client与server之间连接的心跳周期
heartbeat_period
:
"
10s"
# client与server之间连接的超时时间
session_timeout
:
"
20s"
# app fail fast
fail_fast_timeout
:
"
3s"
# connection pool
pool_size
:
64
pool_ttl
:
600
# tcp
getty_session_param
:
compress_encoding
:
true
tcp_no_delay
:
true
tcp_keep_alive
:
true
keep_alive_period
:
"
120s"
tcp_r_buf_size
:
262144
tcp_w_buf_size
:
65536
pkg_rq_size
:
1024
pkg_wq_size
:
512
tcp_read_timeout
:
"
1s"
tcp_write_timeout
:
"
5s"
wait_timeout
:
"
1s"
max_msg_len
:
1024
session_name
:
"
getty-micro-server"
registry
:
basic
:
type
:
"
zookeeper"
reg_addr
:
"
127.0.0.1:2181"
# 与 registry 之间的 lease 时长
keepalive_timeout
:
10
root
:
"
/getty"
group
:
"
bj-yizhuang"
\ No newline at end of file
micro/server/app/config.go
View file @
2c573b8f
...
...
@@ -19,7 +19,6 @@ import (
import
(
"github.com/AlexStocks/getty/micro"
"github.com/AlexStocks/getty/rpc"
"github.com/AlexStocks/goext/log"
log
"github.com/AlexStocks/log4go"
jerrors
"github.com/juju/errors"
"gopkg.in/yaml.v2"
...
...
@@ -63,8 +62,6 @@ func initConf() {
return
}
gxlog
.
CError
(
"conf:%#v"
,
conf
)
if
err
:=
conf
.
ServerConfig
.
CheckValidity
();
err
!=
nil
{
panic
(
jerrors
.
ErrorStack
(
err
))
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment