Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable hcl support for config properties #50

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions baseapp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ import (
)

type TLSConfig struct {
CertFile string `yaml:"cert_file" json:"certFile"`
KeyFile string `yaml:"key_file" json:"keyFile"`
CertFile string `yaml:"cert_file" json:"certFile" hcl:"cert_file"`
KeyFile string `yaml:"key_file" json:"keyFile" hcl:"key_file"`
}

// HTTPConfig contains options for HTTP servers. It is usually embedded in a
// larger configuration struct.
type HTTPConfig struct {
Address string `yaml:"address" json:"address"`
Port int `yaml:"port" json:"port"`
PublicURL string `yaml:"public_url" json:"publicUrl"`
TLSConfig *TLSConfig `yaml:"tls_config" json:"tlsConfig"`
Address string `yaml:"address" json:"address" hcl:"address"`
Port int `yaml:"port" json:"port" hcl:"port"`
PublicURL string `yaml:"public_url" json:"publicUrl" hcl:"public_url,optional"`
TLSConfig *TLSConfig `yaml:"tls_config" json:"tlsConfig" hcl:"tls_config,block"`

ShutdownWaitTime *time.Duration `yaml:"shutdown_wait_time" json:"shutdownWaitTime"`
ShutdownWaitTime *time.Duration `yaml:"shutdown_wait_time" json:"shutdownWaitTime" hcl:"shutdown_wait_time"`
}

// SetValuesFromEnv sets values in the configuration from corresponding
Expand Down Expand Up @@ -63,10 +63,10 @@ func (c *HTTPConfig) SetValuesFromEnv(prefix string) {
// LoggingConfig contains options for logging, such as log level and textual representation.
// It is usually embedded in a larger configuration struct.
type LoggingConfig struct {
Level string `yaml:"level" json:"level"`
Level string `yaml:"level" json:"level" hcl:"level"`

// Pretty will make the output human-readable
Pretty bool `yaml:"pretty" json:"pretty"`
Pretty bool `yaml:"pretty" json:"pretty" hcl:"pretty"`
}

// SetValuesFromEnv sets values in the configuration from corresponding
Expand Down
6 changes: 3 additions & 3 deletions baseapp/datadog/datadog.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ const (
)

type Config struct {
Address string `yaml:"address" json:"address"`
Interval time.Duration `yaml:"interval" json:"interval"`
Tags []string `yaml:"tags" json:"tags"`
Address string `yaml:"address" json:"address" hcl:"address"`
Interval time.Duration `yaml:"interval" json:"interval" hcl:"interval"`
Tags []string `yaml:"tags" json:"tags" hcl:"tags,optional"`
}

// StartEmitter starts a goroutine that emits metrics from the server's
Expand Down