Skip to content

Commit

Permalink
updated config documentation with tls examples
Browse files Browse the repository at this point in the history
  • Loading branch information
lordvidex committed Aug 2, 2023
1 parent 88bc082 commit 963a947
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
18 changes: 13 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net"
"net/url"
"os"
"reflect"
"regexp"
"sort"
"strconv"
Expand Down Expand Up @@ -138,6 +139,8 @@ func binarySearchQueryParamLe(a []QueryParam, duration time.Duration, start, end
// ClickHouse config
type ClickHouse struct {
URL string `toml:"url" json:"url" comment:"default url, see https://clickhouse.tech/docs/en/interfaces/http. Can be overwritten with query-params"`
TLSParams config.TLS `toml:"tls" json:"tls" comment:"mTLS HTTPS configuration for connecting to clickhouse server" commented:"true"`
TLSConfig *tls.Config `toml:"-" json:"-"`
DataTimeout time.Duration `toml:"data-timeout" json:"data-timeout" comment:"default total timeout to fetch data, can be overwritten with query-params"`
RenderMaxQueries int `toml:"render-max-queries" json:"render-max-queries" comment:"Max queries to render queiries"`
RenderMaxConcurrent int `toml:"render-max-concurrent" json:"render-max-concurrent" comment:"Maximum concurrent queries to render queiries"`
Expand Down Expand Up @@ -169,8 +172,6 @@ type ClickHouse struct {
TagTable string `toml:"tag-table" json:"tag-table" comment:"is not recommended to use, https://github.com/lomik/graphite-clickhouse/wiki/TagsRU" commented:"true"`
ExtraPrefix string `toml:"extra-prefix" json:"extra-prefix" comment:"add extra prefix (directory in graphite) for all metrics, w/o trailing dot"`
ConnectTimeout time.Duration `toml:"connect-timeout" json:"connect-timeout" comment:"TCP connection timeout"`
TLSParams *config.TLS `toml:"tls" json:"tls" comment:"mTLS configuration for connecting to clickhouse server" commented:"true"`
TLSConfig *tls.Config `toml:"-" json:"-"`
// TODO: remove in v0.14
DataTableLegacy string `toml:"data-table" json:"data-table" comment:"will be removed in 0.14" commented:"true"`
// TODO: remove in v0.14
Expand Down Expand Up @@ -459,8 +460,8 @@ func (cfg *Config) Parse() error {
if err != nil {
return err
}
if cfg.ClickHouse.TLSParams != nil {
tlsConfig, warns, err := config.ParseClientTLSConfig(cfg.ClickHouse.TLSParams)
if !reflect.DeepEqual(cfg.ClickHouse.TLSParams, config.TLS{}) {
tlsConfig, warns, err := config.ParseClientTLSConfig(&cfg.ClickHouse.TLSParams)
if err != nil {
return err
}
Expand Down Expand Up @@ -707,7 +708,14 @@ func (c *Config) ProcessDataTables() (err error) {
interval = *c.DataTable[i].RollupAutoInterval
}

c.DataTable[i].Rollup, err = rollup.NewAuto(c.ClickHouse.URL, c.ClickHouse.TLSConfig, table, interval, rdp, rdf)
c.DataTable[i].Rollup, err = rollup.NewAuto(
c.ClickHouse.URL,
c.ClickHouse.TLSConfig,
table,
interval,
rdp,
rdf,
)
} else if c.DataTable[i].RollupConf == "none" {
c.DataTable[i].Rollup, err = rollup.NewDefault(rdp, rdf)
} else {
Expand Down
11 changes: 11 additions & 0 deletions doc/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,17 @@ Only one tag used as filter for index field Tag1, see graphite_tagged table [str
[clickhouse]
# default url, see https://clickhouse.tech/docs/en/interfaces/http. Can be overwritten with query-params
url = "http://localhost:8123?cancel_http_readonly_queries_on_client_close=1"

# mTLS HTTPS configuration for connecting to clickhouse server
# [clickhouse.tls]
# ca-cert = []
# client-auth = ""
# server-name = ""
# min-version = ""
# max-version = ""
# insecure-skip-verify = false
# curves = []
# cipher-suites = []
# default total timeout to fetch data, can be overwritten with query-params
data-timeout = "1m0s"
# Max queries to render queiries
Expand Down

0 comments on commit 963a947

Please sign in to comment.