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

pkg/loki: unmarshal module name from YAML #1260

Merged
merged 1 commit into from
Nov 13, 2019
Merged
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
2 changes: 1 addition & 1 deletion cmd/loki/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func main() {

var config loki.Config
if err := cfg.Parse(&config); err != nil {
level.Error(util.Logger).Log("msg", "parsing config", "error", err)
fmt.Fprintf(os.Stderr, "failed parsing config: %v\n", err)
os.Exit(1)
}
if *printVersion {
Expand Down
9 changes: 9 additions & 0 deletions pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ const (
All
)

func (m *moduleName) UnmarshalYAML(unmarshal func(interface{}) error) error {
var val string
if err := unmarshal(&val); err != nil {
return err
}

return m.Set(val)
}

func (m moduleName) String() string {
switch m {
case Ring:
Expand Down