Skip to content

Commit 956226e

Browse files
committed
MINOR: Add configuration option for preferred Time suffix
This option controls how dataplaneapi will serialize Time values when writing the HAProxy configuration file. By default, it will use the most appropriate time unit. Possible values: nearest (the default), none, ms, s, m, h, d. Please consult the HAProxy documentation for the meaning of each suffix. If you choose 'none', then Time values will be written as milliseconds without any suffix, which can be useful for backward compatibility.
1 parent 112c9bc commit 956226e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

client-native/cn.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func ConfigureConfigurationClient(haproxyOptions dataplaneapi_config.HAProxyConf
3636
configuration_options.ValidateCmd(haproxyOptions.ValidateCmd),
3737
configuration_options.MasterWorker,
3838
configuration_options.UseMd5Hash,
39+
configuration_options.PreferredTimeSuffix(haproxyOptions.PreferredTimeSuffix),
3940
)
4041
if err != nil {
4142
return nil, fmt.Errorf("error setting up configuration client: %s", err.Error())

configuration/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type HAProxyConfiguration struct {
6060
GeneralStorageDir string `long:"general-storage-dir" description:"Path to general storage directory" default:"/etc/haproxy/general" group:"resources"`
6161
ClusterTLSCertDir string `long:"cluster-tls-dir" description:"Path where cluster tls certificates will be stored. Defaults to same directory as dataplane configuration file" group:"cluster"`
6262
DataplaneStorageDir string `long:"dataplane-storage-dir" description:"Path to dataplane internal storage directory" default:"/etc/haproxy/dataplane" group:"resources"`
63+
PreferredTimeSuffix string `long:"time-suffix" description:"Preferred time unit to use when writing time values in configuration (nearest, none, ms, s, m, h, d)" default:"nearest" group:"haproxy"`
6364
UpdateMapFilesPeriod int64 `long:"update-map-files-period" description:"Elapsed time in seconds between two maps syncing operations" default:"10" group:"resources"`
6465
ReloadDelay int `short:"d" long:"reload-delay" description:"Minimum delay between two reloads (in s)" default:"5" group:"reload"`
6566
MaxOpenTransactions int64 `long:"max-open-transactions" description:"Limit for active transaction in pending state" default:"20" group:"transaction"`

0 commit comments

Comments
 (0)