Skip to content

Commit

Permalink
update rethinkdb connection options
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Jan 21, 2019
1 parent b4a0f86 commit c573df1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions server/db/rethinkdb/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type configType struct {
WriteTimeout int `json:"write_timeout,omitempty"`
ReadTimeout int `json:"read_timeout,omitempty"`
KeepAlivePeriod int `json:"keep_alive_timeout,omitempty"`
UseJSONNumber bool `json:"use_json_number,omitempty"`
NumRetries int `json:"num_retries,omitempty"`
InitialCap int `json:"initial_cap,omitempty"`
MaxOpen int `json:"max_open,omitempty"`
DiscoverHosts bool `json:"discover_hosts,omitempty"`
Expand Down Expand Up @@ -96,6 +98,8 @@ func (a *adapter) Open(jsonconfig string) error {
opts.WriteTimeout = time.Duration(config.WriteTimeout) * time.Second
opts.ReadTimeout = time.Duration(config.ReadTimeout) * time.Second
opts.KeepAlivePeriod = time.Duration(config.KeepAlivePeriod) * time.Second
opts.UseJSONNumber = config.UseJSONNumber
opts.NumRetries = config.NumRetries
opts.InitialCap = config.InitialCap
opts.MaxOpen = config.MaxOpen
opts.DiscoverHosts = config.DiscoverHosts
Expand Down
7 changes: 4 additions & 3 deletions server/tinode.conf
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@

// Configurations of individual adapters.
"adapters": {
// MySQL configuration.
// MySQL configuration. See https://godoc.org/github.com/go-sql-driver/mysql#Config
// for other possible options.
"mysql": {
// DSN, passed unchanged to MySQL driver. The 'parseTime=true' is required.
// The 'collation=utf8mb4_unicode_ci' is optional but highly recommended for
Expand All @@ -150,11 +151,11 @@
"database": "tinode"
},

// RethinkDB configuration. See https://godoc.org/github.com/GoRethink/gorethink#ConnectOpts
// RethinkDB configuration. https://godoc.org/github.com/rethinkdb/rethinkdb-go#ConnectOpts
// for other possible options.
"rethinkdb": {
// Address(es) of RethinkDB node(s): either a string or an array of strings.
"addresses": "localhost:28015" ,
"addresses": "localhost:28015",
// Name of the main database.
"database": "tinode"
}
Expand Down

0 comments on commit c573df1

Please sign in to comment.