forked from go-dev-frame/sponge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverNameExample.yml
More file actions
158 lines (134 loc) · 8.38 KB
/
Copy pathserverNameExample.yml
File metadata and controls
158 lines (134 loc) · 8.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# If you need to convert YAML to a Go struct, please execute the command: make update-config
# app settings
app:
name: "serverNameExample" # server name
env: "dev" # runtime environment, dev: development environment, prod: production environment, test: test environment
version: "v0.0.0"
host: "127.0.0.1" # domain or ip, for service registration
enableStat: true # whether to turn on printing statistics, true:enable, false:disable
enableMetrics: true # whether to turn on indicator collection, true:enable, false:disable
enableHTTPProfile: false # whether to turn on performance analysis, true:enable, false:disable
enableLimit: false # whether to turn on rate limiting (adaptive), true:on, false:off
enableCircuitBreaker: false # whether to turn on circuit breaker(adaptive), true:on, false:off
enableTrace: false # whether to turn on trace, true:enable, false:disable, if true jaeger configuration must be set
tracingSamplingRate: 1.0 # tracing sampling rate, between 0 and 1, 0 means no sampling, 1 means sampling all links
registryDiscoveryType: "" # registry and discovery types: consul, etcd, nacos, if empty, registration and discovery are not used
cacheType: "" # cache type, if empty, the cache is not used, support for "memory" and "redis", if set to redis, must set redis configuration
# todo generate http or rpc server configuration here
# delete the templates code start
# http server settings
http:
port: 8080 # listen port
timeout: 0 # request timeout, unit(second), if 0 means not set, if greater than 0 means set timeout, if enableHTTPProfile is true, it needs to set 0 or greater than 60s
# grpc server settings
grpc:
port: 8282 # listen port
httpPort: 8283 # profile and metrics ports
enableToken: false # whether to enable server-side token authentication, default appID=grpc, appKey=123456
# serverSecure parameter setting
# if type="", it means no secure connection, no need to fill in any parameters
# if type="one-way", it means server-side certification, only the fields 'certFile' and 'keyFile' should be filled in
# if type="two-way", it means both client and server side certification, fill in all fields
serverSecure:
type: "" # secures type, "", "one-way", "two-way"
caFile: "" # ca certificate file, valid only in "two-way", absolute path
certFile: "" # server side cert file, absolute path
keyFile: "" # server side key file, absolute path
# grpc client-side settings, support for setting up multiple grpc clients.
grpcClient:
- name: "serverNameExample" # grpc service name, used for service discovery
host: "127.0.0.1" # grpc service address, used for direct connection
port: 8282 # grpc service port
timeout: 0 # request timeout, unit(second), if 0 means not set, if greater than 0 means set timeout, valid only for unary grpc type
registryDiscoveryType: "" # registration and discovery types: consul, etcd, nacos, if empty, connecting to server using host and port
# clientSecure parameter setting
# if type="", it means no secure connection, no need to fill in any parameters
# if type="one-way", it means server-side certification, only the fields 'serverName' and 'certFile' should be filled in
# if type="two-way", it means both client and server side certification, fill in all fields
clientSecure:
type: "" # secures type, "", "one-way", "two-way"
serverName: "" # server name, e.g. *.foo.com
caFile: "" # client side ca file, valid only in "two-way", absolute path
certFile: "" # client side cert file, absolute path, if secureType="one-way", fill in server side cert file here
keyFile: "" # client side key file, valid only in "two-way", absolute path
clientToken:
enable: false # whether to enable token authentication
appID: "" # app id
appKey: "" # app key
# delete the templates code end
# logger settings
logger:
level: "info" # output log levels debug, info, warn, error, default is debug
format: "console" # output format, console or json, default is console
isSave: false # false:output to terminal, true:output to file, default is false
#logFileConfig: # Effective when isSave=true
#filename: "out.log" # File name (default is out.log)
#maxSize: 20 # Maximum file size (MB, default is 10MB)
#maxBackups: 50 # Maximum number of old files to retain (default is 100)
#maxAge: 15 # Maximum number of days to retain old files (default is 30 days)
#isCompression: true # Whether to compress/archive old files (default is false)
# todo generate the database configuration here
# delete the templates code start
# database setting
database:
driver: "mysql" # database driver, currently support mysql, postgresql, sqlite
# mysql settings
mysql:
# dsn format, <username>:<password>@(<hostname>:<port>)/<db>?[k=v& ......]
dsn: "root:123456@(192.168.3.37:3306)/account?parseTime=true&loc=Local&charset=utf8mb4&collation=utf8mb4_general_ci"
enableLog: true # whether to turn on printing of all logs
maxIdleConns: 10 # set the maximum number of connections in the idle connection pool
maxOpenConns: 100 # set the maximum number of open database connections
connMaxLifetime: 10 # sets the maximum time for which the connection can be reused, in minutes
#slavesDsn: # sets slaves mysql dsn, array type
# - "your slave dsn 1"
# - "your slave dsn 2"
#mastersDsn: # sets masters mysql dsn, array type, non-required field, if there is only one master, there is no need to set the mastersDsn field, the default dsn field is mysql master.
# - "your master dsn"
# postgresql settings
postgresql:
# dsn format, <username>:<password>@<hostname>:<port>/<db>?[k=v& ......]
dsn: "root:123456@192.168.3.37:5432/account?sslmode=disable"
enableLog: true # whether to turn on printing of all logs
maxIdleConns: 10 # set the maximum number of connections in the idle connection pool
maxOpenConns: 100 # set the maximum number of open database connections
connMaxLifetime: 10 # sets the maximum time for which the connection can be reused, in minutes
# sqlite settings
sqlite:
dbFile: "test/sql/sqlite/sponge.db" # if you are in a Windows environment, the path separator is \\
enableLog: true # whether to turn on printing of all logs
maxIdleConns: 10 # set the maximum number of connections in the idle connection pool
maxOpenConns: 100 # set the maximum number of open database connections
connMaxLifetime: 10 # sets the maximum time for which the connection can be reused, in minutes
# mongodb settings
mongodb:
# dsn format, [scheme://]<username>:<password>@<hostname1>:<port1>[,<hostname2>:<port2>,......]/<db>?[k=v& ......]
# default scheme is mongodb://, scheme can be omitted, if you want to use ssl, you can use mongodb+srv:// scheme, the scheme must be filled in
# parameter k=v see https://www.mongodb.com/docs/drivers/go/current/fundamentals/connections/connection-guide/#connection-options
dsn: "root:123456@192.168.3.37:27017/account?connectTimeoutMS=15000"
# delete the templates code end
# redis settings
redis:
# dsn format, [user]:<pass>@127.0.0.1:6379/[db], the default user is default, redis version 6.0 and above only supports user.
dsn: "default:123456@192.168.3.37:6379/0"
dialTimeout: 10 # connection timeout, unit(second)
readTimeout: 2 # read timeout, unit(second)
writeTimeout: 2 # write timeout, unit(second)
# jaeger settings
jaeger:
agentHost: "192.168.3.37"
agentPort: 6831
# todo generate the registry and discovery configuration here
# delete the templates code start
# consul settings
consul:
addr: "192.168.3.37:8500"
# etcd settings
etcd:
addrs: ["192.168.3.37:2379"]
# nacos settings, used in service registration discovery
nacosRd:
ipAddr: "192.168.3.37"
port: 8848
namespaceID: "3454d2b5-2455-4d0e-bf6d-e033b086bb4c" # namespace id
# delete the templates code end